|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.objects.AbstractReference2ObjectFunction<K,V>
public abstract class AbstractReference2ObjectFunction<K,V>
An abstract class providing basic methods for functions implementing a type-specific interface.
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.
Field Summary | |
---|---|
static long |
serialVersionUID
|
Method Summary | |
---|---|
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). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface it.unimi.dsi.fastutil.Function |
---|
containsKey, get, size |
Field Detail |
---|
public static final long serialVersionUID
Method Detail |
---|
public void defaultReturnValue(V rv)
Reference2ObjectFunction
get()
, 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 Reference2ObjectFunction<K,V>
rv
- the new default return value.Reference2ObjectFunction.defaultReturnValue()
public V defaultReturnValue()
Reference2ObjectFunction
defaultReturnValue
in interface Reference2ObjectFunction<K,V>
public V put(K key, V value)
Function
put
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)
Function
remove
in interface Function<K,V>
null
if no value was present for the given key.Map.remove(Object)
public void clear()
Function
clear
in interface Function<K,V>
Map.clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |