Class ReferenceIdentityMap
java.lang.Object
org.apache.xbean.propertyeditor.ReferenceIdentityMap
- All Implemented Interfaces:
Map
Streamlined version of a WeakIdentityHashMap. Provides Identity semantics with
Weak References to keys. This allows proxies to be GC'ed when no longer referenced
by clients.
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.
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the map, resetting the size to zero and nullifying references to avoid garbage collection issues.booleancontainsKey(Object key) Checks whether the map contains the specified key.booleancontainsValue(Object value) Checks whether the map contains the specified value.entrySet()Gets the value mapped to the key specified.booleanisEmpty()Checks whether the map is currently empty.keySet()Puts a key-value entry into this map.voidRemoves the specified mapping from this map.intsize()Gets the size of the map.values()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ReferenceIdentityMap
public ReferenceIdentityMap()
-
-
Method Details
-
size
-
isEmpty
-
containsKey
Checks whether the map contains the specified key.- Specified by:
containsKeyin interfaceMap- Parameters:
key- the key to search for- Returns:
- true if the map contains the key
-
containsValue
Checks whether the map contains the specified value.- Specified by:
containsValuein interfaceMap- Parameters:
value- the value to search for- Returns:
- true if the map contains the value
-
get
-
put
Puts a key-value entry into this map. Neither the key nor the value may be null. -
remove
-
clear
-
values
-
putAll
-
entrySet
-
keySet
-