|
Final | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectjava.util.AbstractMap
java.util.IdentityHashMap
IdentityHashMap This is a variant on HashMap which tests equality by reference instead of by value. Basically, keys and values are compared for equality by checking if their references are equal rather than by calling the "equals" function. IdentityHashMap uses open addressing (linear probing in particular) for collision resolution. This is different from HashMap which uses Chaining. Like HashMap, IdentityHashMap is not thread safe, so access by multiple threads must be synchronized by an external mechanism such as Collections.synchronizedMap. It accepts null keys and null values, including null key-value pairs.
| Nested Class Summary |
|---|
| Nested classes inherited from class java.util.Map |
|---|
Map.Entry |
| Constructor Summary | |
|---|---|
IdentityHashMap()
Create an IdentityHashMap with default maximum size |
|
IdentityHashMap(int maxSize)
Create an IdentityHashMap with the given maximum size parameter |
|
IdentityHashMap(Map map)
Create an IdentityHashMap using the given Map as initial values. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all elements from this Map, leaving it empty. |
Object |
clone()
Answers a new IdentityHashMap with the same mappings and size as this one. |
boolean |
containsKey(Object key)
Searches this Map for the specified key. |
boolean |
containsValue(Object value)
Searches this Map for the specified value. |
Set |
entrySet()
Answers a Set of the mappings contained in this IdentityHashMap. |
boolean |
equals(Object object)
Compares this map with other objects. |
Object |
get(Object key)
Answers the value of the mapping with the specified key. |
boolean |
isEmpty()
Answers if this IdentityHashMap has no elements, a size of zero. |
Set |
keySet()
Answers a Set of the keys contained in this IdentityHashMap. |
Object |
put(Object key,
Object value)
Maps the specified key to the specified value. |
Object |
remove(Object key)
Removes a mapping with the specified key from this IdentityHashMap. |
int |
size()
Answers the number of mappings in this IdentityHashMap. |
Collection |
values()
Answers a Collection of the values contained in this IdentityHashMap. |
| Methods inherited from class java.util.AbstractMap |
|---|
hashCode, putAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
hashCode, putAll |
| Constructor Detail |
public IdentityHashMap()
public IdentityHashMap(int maxSize)
maxSize - The estimated maximum number of entries that will be put in this map.public IdentityHashMap(Map map)
map - A map of (key,value) pairs to copy into the IdentityHashMap| Method Detail |
public void clear()
clear in interface Mapclear in class AbstractMapUnsupportedOperationException - when removing from this Map
is not supportedisEmpty(),
size()public boolean containsKey(Object key)
containsKey in interface MapcontainsKey in class AbstractMapkey - the object to search for
key is a key of this Map, false otherwisepublic boolean containsValue(Object value)
containsValue in interface MapcontainsValue in class AbstractMapvalue - the object to search for
value is a value of this Map, false otherwisepublic Object get(Object key)
get in interface Mapget in class AbstractMapkey - the key
public Object put(Object key,
Object value)
put in interface Mapput in class AbstractMapkey - the keyvalue - the value
public Object remove(Object key)
remove in interface Mapremove in class AbstractMapkey - the key of the mapping to remove
public Set entrySet()
entrySet in interface MapentrySet in class AbstractMappublic Set keySet()
keySet in interface MapkeySet in class AbstractMappublic Collection values()
values in interface Mapvalues in class AbstractMappublic boolean equals(Object object)
equals in interface Mapequals in class AbstractMapobject - the object to compare with this object
AbstractMap.hashCode()public Object clone()
clone in class AbstractMapCloneablepublic boolean isEmpty()
isEmpty in interface MapisEmpty in class AbstractMapsize()public int size()
size in interface Mapsize in class AbstractMap
|
Final | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||