Package org.onehippo.cms7.util
Class WeakIdentityMap<K,V>
java.lang.Object
org.onehippo.cms7.util.WeakIdentityMap<K,V>
Implements a combination of
WeakHashMap
and
IdentityHashMap
.
Useful for caches that need to key off of a ==
comparison
instead of a .equals
.
This class is not a general-purpose Map
implementation! It intentionally violates
Map's general contract, which mandates the use of the equals method
when comparing objects. This class is designed for use only in the
rare cases wherein reference-equality semantics are required.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
isEmpty()
static final <K,
V> WeakIdentityMap<K, V> Creates a newWeakIdentityMap
based on aConcurrentHashMap
.static final <K,
V> WeakIdentityMap<K, V> Creates a newWeakIdentityMap
based on a non-synchronizedHashMap
.int
size()
-
Method Details
-
newHashMap
Creates a newWeakIdentityMap
based on a non-synchronizedHashMap
. -
newConcurrentHashMap
Creates a newWeakIdentityMap
based on aConcurrentHashMap
. -
clear
public void clear() -
containsKey
-
get
-
put
-
isEmpty
public boolean isEmpty() -
remove
-
size
public int size()
-