public class ReferenceIdentityMap
extends java.lang.Object
implements java.util.Map
BasicProxymanager.destroyProxy() need not be invoked when a
proxy is no longer needed. Note that this is not a full Map implementation.
The iteration and collection capabilities of Map have been discarded to keep the
implementation lightweight.
Much of this code was cribbed from the Commons Collection 3.1 implementation of
ReferenceIdentityMap and AbstractReferenceMap.
| Constructor and Description |
|---|
ReferenceIdentityMap() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the map, resetting the size to zero and nullifying references
to avoid garbage collection issues.
|
boolean |
containsKey(java.lang.Object key)
Checks whether the map contains the specified key.
|
boolean |
containsValue(java.lang.Object value)
Checks whether the map contains the specified value.
|
java.util.Set |
entrySet() |
java.lang.Object |
get(java.lang.Object key)
Gets the value mapped to the key specified.
|
boolean |
isEmpty()
Checks whether the map is currently empty.
|
java.util.Set |
keySet() |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Puts a key-value entry into this map.
|
void |
putAll(java.util.Map t) |
java.lang.Object |
remove(java.lang.Object key)
Removes the specified mapping from this map.
|
int |
size()
Gets the size of the map.
|
java.util.Collection |
values() |
public int size()
size in interface java.util.Mappublic boolean isEmpty()
isEmpty in interface java.util.Mappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Mapkey - the key to search forpublic boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Mapvalue - the value to search forpublic java.lang.Object get(java.lang.Object key)
get in interface java.util.Mapkey - the keypublic java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mapkey - the key to add, must not be nullvalue - the value to add, must not be nullpublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapkey - the mapping to removepublic void clear()
clear in interface java.util.Mappublic java.util.Collection values()
values in interface java.util.Mappublic void putAll(java.util.Map t)
putAll in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Mappublic java.util.Set keySet()
keySet in interface java.util.Map