public interface Char2ReferenceFunction<V> extends Function<Character,V>
Function; provides some additional methods that use
polymorphism to avoid (un)boxing.
Type-specific versions of get(), put() and
remove() cannot rely on null to denote absence of a key.
Rather, they return a default return
value, which is set to 0 cast to the return type (false for
booleans) at creation, but can be changed using the
defaultReturnValue() method.
For uniformity reasons, even maps returning objects implement the default
return value (of course, in this case the default return value is initialized
to null).
Warning: to fall in line as much as possible with the
standard map interface, it is strongly suggested
that standard versions of get(), put() and
remove() for maps with primitive-type values return
null to denote missing keys rather than wrap the default return
value in an object (of course, for maps with object keys and values this is
not possible, as there is no type-specific version).
Function| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(char key)
Returns
true if this map contains a mapping for the specified
key. |
boolean |
containsKey(Object key)
Deprecated.
Please use the corresponding type-specific method instead.
|
V |
defaultReturnValue()
Gets the default return value.
|
void |
defaultReturnValue(V rv)
Sets the default return value.
|
V |
get(char key)
Returns the value to which the given key is mapped.
|
V |
get(Object key)
Deprecated.
Please use the corresponding type-specific method instead.
|
V |
put(Character key,
V value)
Deprecated.
Please use the corresponding type-specific method instead.
|
V |
put(char key,
V value)
Adds a pair to the map (optional operation).
|
V |
remove(char key)
Removes the mapping with the given key (optional operation).
|
V |
remove(Object key)
Deprecated.
Please use the corresponding type-specific method instead.
|
V put(char key, V value)
key - the key.value - the value.Function.put(Object,Object)V get(char key)
key - the key.Function.get(Object)V remove(char key)
key - the key.Function.remove(Object)@Deprecated V put(Character key, V value)
put in interface Function<Character,V>key - the key.value - the value.null if no value was present for the given key.Map.put(Object,Object)@Deprecated V get(Object key)
get in interface Function<Character,V>key - the key.null if no value was present for the given key.Map.get(Object)@Deprecated V remove(Object key)
remove in interface Function<Character,V>key - the key.null if no value was present for the given key.Map.remove(Object)boolean containsKey(char key)
true if this map contains a mapping for the specified
key.Function.containsKey(Object)@Deprecated boolean containsKey(Object key)
Note that for some kind of functions (e.g., hashes) this method will always return true.
containsKey in interface Function<Character,V>key - the key.key.Map.containsKey(Object)void defaultReturnValue(V rv)
get(), put() and remove() to
denote that the map does not contain the specified key. It must be
0/false/null by default.rv - the new default return value.defaultReturnValue()V defaultReturnValue()