|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.unimi.dsi.fastutil.objects.AbstractReference2ReferenceMap
An abstract class providing basic methods for maps implementing a type-specific interface.
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.
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).
As a further help, this class provides a BasicEntry inner class
that implements a type-specific version of Map.Entry; it
is particularly useful for those classes that do not implement their own
entries (e.g., most immutable maps).
| Nested Class Summary | |
static class |
AbstractReference2ReferenceMap.BasicEntry
This class provides a basic but complete type-specific entry class for all those maps implementations that do not have entries on their own (e.g., most immutable maps). |
| Nested classes inherited from class it.unimi.dsi.fastutil.objects.Reference2ReferenceMap |
Reference2ReferenceMap.Entry |
| Method Summary | |
void |
clear()
|
boolean |
containsKey(Object k)
Checks whether the given value is contained in keySet(). |
boolean |
containsValue(Object v)
Checks whether the given value is contained in values(). |
Object |
defaultReturnValue()
Gets the default return value. |
void |
defaultReturnValue(Object rv)
Sets the default return value. |
boolean |
equals(Object o)
|
Object |
getDefRetValue()
|
int |
hashCode()
Returns a hash code for this map. |
boolean |
isEmpty()
|
Set |
keySet()
Returns a type-specific-set view of the keys of this map. |
Object |
put(Object key,
Object value)
|
void |
putAll(Map m)
Puts all pairs in the given map. |
Object |
remove(Object key)
|
void |
setDefRetValue(Object rv)
|
String |
toString()
|
Collection |
values()
Returns a type-specific-set view of the values of this map. |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
entrySet, get, size |
| Method Detail |
public void setDefRetValue(Object rv)
setDefRetValue in interface Reference2ReferenceMaprv - the new default return value.Reference2ReferenceMap.getDefRetValue(),
Reference2ReferenceMap.defaultReturnValue()public Object getDefRetValue()
getDefRetValue in interface Reference2ReferenceMapReference2ReferenceMap.defaultReturnValue()public void defaultReturnValue(Object rv)
Reference2ReferenceMapget(), 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 Reference2ReferenceMaprv - the new default return value.Reference2ReferenceMap.defaultReturnValue()public Object defaultReturnValue()
Reference2ReferenceMap
defaultReturnValue in interface Reference2ReferenceMap
public Object put(Object key,
Object value)
put in interface Mappublic Object remove(Object key)
remove in interface Mappublic void clear()
clear in interface Mappublic boolean containsValue(Object v)
values().
containsValue in interface Mappublic boolean containsKey(Object k)
keySet().
containsKey in interface Mappublic void putAll(Map m)
putAll in interface Mapm - a map.public boolean isEmpty()
isEmpty in interface Mappublic Set keySet()
The view is backed by the set returned by Map.entrySet(). Note that
no attempt is made at caching the result of this method, as this would
require adding some attributes that lightweight implementations would
not need. Subclasses may easily override this policy by calling
this method and caching the result, but implementors are encouraged to
write more efficient ad-hoc implementations.
keySet in interface Mappublic Collection values()
The view is backed by the set returned by Map.entrySet(). Note that
no attempt is made at caching the result of this method, as this would
require adding some attributes that lightweight implementations would
not need. Subclasses may easily override this policy by calling
this method and caching the result, but implementors are encouraged to
write more efficient ad-hoc implementations.
values in interface Mappublic int hashCode()
hashCode in interface Mappublic boolean equals(Object o)
equals in interface Mappublic String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||