Class Char2ObjectFunctions.Singleton<V>
- java.lang.Object
-
- org.codelibs.jhighlight.fastutil.chars.AbstractChar2ObjectFunction<V>
-
- org.codelibs.jhighlight.fastutil.chars.Char2ObjectFunctions.Singleton<V>
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Char2ObjectFunction<V>
,Function<Character,V>
- Enclosing class:
- Char2ObjectFunctions
public static class Char2ObjectFunctions.Singleton<V> extends AbstractChar2ObjectFunction<V> implements Serializable, Cloneable
An immutable class representing a type-specific singleton function.This class may be useful to implement your own in case you subclass a type-specific function.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected char
key
protected V
value
-
Fields inherited from class org.codelibs.jhighlight.fastutil.chars.AbstractChar2ObjectFunction
defRetValue
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
boolean
containsKey(char k)
V
get(char k)
Returns the value to which the given key is mapped.int
size()
Returns the intended number of keys in this function, or -1 if no such number exists.-
Methods inherited from class org.codelibs.jhighlight.fastutil.chars.AbstractChar2ObjectFunction
clear, containsKey, defaultReturnValue, defaultReturnValue, get, put, put, remove, remove
-
-
-
-
Field Detail
-
key
protected final char key
-
value
protected final V value
-
-
Constructor Detail
-
Singleton
protected Singleton(char key, V value)
-
-
Method Detail
-
containsKey
public boolean containsKey(char k)
- Specified by:
containsKey
in interfaceChar2ObjectFunction<V>
- See Also:
Function.containsKey(Object)
-
get
public V get(char k)
Description copied from interface:Char2ObjectFunction
Returns the value to which the given key is mapped.- Specified by:
get
in interfaceChar2ObjectFunction<V>
- Parameters:
k
- the key.- Returns:
- the corresponding value, or the default return value if no value was present for the given key.
- See Also:
Function.get(Object)
-
size
public int size()
Description copied from interface:Function
Returns the intended number of keys in this function, or -1 if no such number exists.Most function implementations will have some knowledge of the intended number of keys in their domain. In some cases, however, this might not be possible.
-
-