public class WeakIdentityMap<K,V>
extends java.util.AbstractMap<K,V>
implements java.util.Map<K,V>
The documentation for WeakHashMap states that it is intended primarily for use with key objects whose equals methods test for object identity using the == operator. Because WeakIdentityMap strictly follows this behavior, it is better suited for this purpose.
Note: Weakly referenced entries may be automatically removed during either accessor or mutator operations, possibly causing a concurrent modification to be detected. Therefore, even if multiple threads are only accessing this map, be sure to synchronize this map first. Also, do not rely on the value returned by size() when using an iterator from this map. The iterators may return less entries than the amount reported by size().
Constructor and Description |
---|
WeakIdentityMap() |
WeakIdentityMap(int initialCapacity) |
WeakIdentityMap(int initialCapacity,
float loadFactor) |
WeakIdentityMap(java.util.Map<? extends K,? extends V> t) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
java.lang.Object |
clone() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
V |
get(java.lang.Object key) |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> t) |
V |
remove(java.lang.Object key) |
int |
size() |
java.lang.String |
toString()
Gets the map as a String.
|
java.util.Collection<V> |
values() |
public WeakIdentityMap(int initialCapacity, float loadFactor)
public WeakIdentityMap(int initialCapacity)
public WeakIdentityMap()
public java.lang.String toString()
public int size()
public boolean isEmpty()
public boolean containsValue(java.lang.Object value)
public boolean containsKey(java.lang.Object key)
public V get(java.lang.Object key)
public V remove(java.lang.Object key)
public void clear()
public java.util.Set<K> keySet()
public java.util.Collection<V> values()
Copyright © 2005-2018 Potix Corporation. All Rights Reserved.