public abstract class AbstractObject2ObjectFunction<K,V> extends Object implements Object2ObjectFunction<K,V>, Serializable
Optional operations just throw an UnsupportedOperationException. Generic versions of accessors delegate to the corresponding type-specific counterparts following the interface rules
(they take care of returning null on a missing key).
This class handles directly a default return value (including methods to access it). Instances of classes inheriting from this class have just to return
defRetValue to denote lack of a key in type-specific methods. The value is serialized.
Implementing subclasses have just to provide type-specific get(), type-specific containsKey(), and size() methods.
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all associations from this function (optional operation).
|
V |
defaultReturnValue()
Gets the default return value.
|
void |
defaultReturnValue(V rv)
Sets the default return value.
|
V |
put(K key,
V value)
Associates the specified value with the specified key in this function (optional operation).
|
V |
remove(Object key)
Removes this key and the associated value from this function if it is present (optional operation).
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontainsKey, get, sizepublic void defaultReturnValue(V rv)
Object2ObjectFunctionget(), put() and remove() to denote that the map does not contain the specified key. It must be
0/false/null by default.defaultReturnValue in interface Object2ObjectFunction<K,V>rv - the new default return value.Object2ObjectFunction.defaultReturnValue()public V defaultReturnValue()
Object2ObjectFunctiondefaultReturnValue in interface Object2ObjectFunction<K,V>public V put(K key, V value)
Functionput in interface Function<K,V>key - the key.value - the value.null if no value was present for the given key.Map.put(Object,Object)public V remove(Object key)
Functionremove in interface Function<K,V>key - the key.null if no value was present for the given key.Map.remove(Object)