Package org.onehippo.cms7.util
Class WeakIdentityMap<K,V>
- java.lang.Object
-
- org.onehippo.cms7.util.WeakIdentityMap<K,V>
-
public final class WeakIdentityMap<K,V> extends Object
Implements a combination ofWeakHashMap
andIdentityHashMap
. 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(Object key)
V
get(Object key)
boolean
isEmpty()
static <K,V>
WeakIdentityMap<K,V>newConcurrentHashMap()
Creates a newWeakIdentityMap
based on aConcurrentHashMap
.static <K,V>
WeakIdentityMap<K,V>newHashMap()
Creates a newWeakIdentityMap
based on a non-synchronizedHashMap
.V
put(K key, V value)
V
remove(Object key)
int
size()
-
-
-
Method Detail
-
newHashMap
public static final <K,V> WeakIdentityMap<K,V> newHashMap()
Creates a newWeakIdentityMap
based on a non-synchronizedHashMap
.
-
newConcurrentHashMap
public static final <K,V> WeakIdentityMap<K,V> newConcurrentHashMap()
Creates a newWeakIdentityMap
based on aConcurrentHashMap
.
-
clear
public void clear()
-
containsKey
public boolean containsKey(Object key)
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
-