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.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
key
- the key to search forpublic boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
value
- the value to search forpublic java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
key
- the keypublic java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
key
- 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.Map
key
- the mapping to removepublic void clear()
clear
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public void putAll(java.util.Map t)
putAll
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map