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 charkeyprotected Vvalue-
Fields inherited from class org.codelibs.jhighlight.fastutil.chars.AbstractChar2ObjectFunction
defRetValue
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()booleancontainsKey(char k)Vget(char k)Returns the value to which the given key is mapped.intsize()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:
containsKeyin interfaceChar2ObjectFunction<V>- See Also:
Function.containsKey(Object)
-
get
public V get(char k)
Description copied from interface:Char2ObjectFunctionReturns the value to which the given key is mapped.- Specified by:
getin 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:FunctionReturns 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.
-
-