WeakHashMap this class does not handle dead keys during common
access operations, but expects you to call its maintain() method
periodically. Both keys and values are expected to be not-null.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final ConcurrentMap | |
| private final ReferenceQueue |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | clear()
Overrides java. Implements java. Removes all of the mappings from this map (optional operation). |
| public boolean | containsKey(Object
key whose presence in this map is to be tested key)Overrides java. Implements java. Returns |
| public boolean | containsValue(Object
value whose presence in this map is to be tested value)Overrides java. Implements java. Returns |
| private ManagedConcurrentWeakHashMap. | |
| private ManagedConcurrentWeakHashMap. | |
| public Set | entrySet()
Implements abstract java. Implements java. Returns a |
| public V | get(Object
the key whose associated value is to be returned key)Overrides java. Implements java. Returns the value to which the specified key is mapped,
or |
| public boolean | isEmpty()
Overrides java. Implements java. Returns |
| public void | |
| public V | put(K
key with which the specified value is to be associated key, V value to be associated with the specified key value)Overrides java. Implements java. Associates the specified value with the specified key in this map (optional operation). |
| public V | putIfAbsent(K
key with which the specified value is to be associated key, V value to be associated with the specified key value)Overrides default java. Implements java. If the specified key is not already associated with a value, associates it with the given value. |
| public V | remove(Object
key whose mapping is to be removed from the map key)Overrides java. Implements java. Removes the mapping for a key from this map if it is present (optional operation). |
| public boolean | remove(Object
key with which the specified value is associated key, Object value expected to be associated with the specified key value)Overrides default java. Implements java. Removes the entry for a key only if currently mapped to a given value. |
| public boolean | replace(K
key with which the specified value is associated key, V value expected to be associated with the specified key oldValue, V value to be associated with the specified key newValue)Overrides default java. Implements java. Replaces the entry for a key only if currently mapped to a given value. |
| public V | replace(K
key with which the specified value is associated key, V value to be associated with the specified key value)Overrides default java. Implements java. Replaces the entry for a key only if currently mapped to some value. |
| public int | size()
Overrides java. Implements java. Returns the number of key-value mappings in this map. |
| public Collection | values()
Overrides java. Implements java. Returns a |
| map | back to summary |
|---|---|
| private final ConcurrentMap<ManagedConcurrentWeakHashMap. | |
| queue | back to summary |
|---|---|
| private final ReferenceQueue<Object> queue | |
| ManagedConcurrentWeakHashMap | back to summary |
|---|---|
| public ManagedConcurrentWeakHashMap() | |
| clear | back to summary |
|---|---|
| public void clear() Overrides java. Implements java. Doc from java. Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.
| |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(Object key) Overrides java. Implements java. Doc from java. Returns | |
| containsValue | back to summary |
|---|---|
| public boolean containsValue(Object value) Overrides java. Implements java. Doc from java. Returns | |
| createLookupKey | back to summary |
|---|---|
| private ManagedConcurrentWeakHashMap. Creates Key instance to be used only to lookup values in the map. It is not registered with the ReferenceQueue. | |
| createStoreKey | back to summary |
|---|---|
| private ManagedConcurrentWeakHashMap. Creates Key instance to be used to store values in the map. It is registered with the ReferenceQueue. | |
| entrySet | back to summary |
|---|---|
| public Set Implements abstract java. Implements java. Doc from java. Returns a | |
| get | back to summary |
|---|---|
| public V get(Object key) Overrides java. Implements java. Doc from java. Returns the value to which the specified key is mapped,
or More formally, if this map contains a mapping from a key
If this map permits null values, then a return value of
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Overrides java. Implements java. Doc from java. Returns
| |
| maintain | back to summary |
|---|---|
| public void maintain() Method, that has to be invoked periodically to clean dead keys from the map. | |
| put | back to summary |
|---|---|
| public V put(K key, V value) Overrides java. Implements java. Doc from java. Associates the specified value with the specified key in this map
(optional operation). If the map previously contained a mapping for
the key, the old value is replaced by the specified value. (A map
| |
| putIfAbsent | back to summary |
|---|---|
| public V putIfAbsent(K key, V value) Overrides default java. Implements java. Doc from java. If the specified key is not already associated
with a value, associates it with the given value.
This is equivalent to, for this
except that the action is performed atomically.
| |
| remove | back to summary |
|---|---|
| public V remove(Object key) Overrides java. Implements java. Doc from java. Removes the mapping for a key from this map if it is present
(optional operation). More formally, if this map contains a mapping
from key Returns the value to which this map previously associated the key,
or If this map permits null values, then a return value of
The map will not contain a mapping for the specified key once the call returns. | |
| remove | back to summary |
|---|---|
| public boolean remove(Object key, Object value) Overrides default java. Implements java. Doc from java. Removes the entry for a key only if currently mapped to a given value.
This is equivalent to, for this
except that the action is performed atomically.
| |
| replace | back to summary |
|---|---|
| public boolean replace(K key, V oldValue, V newValue) Overrides default java. Implements java. Doc from java. Replaces the entry for a key only if currently mapped to a given value.
This is equivalent to, for this
except that the action is performed atomically.
| |
| replace | back to summary |
|---|---|
| public V replace(K key, V value) Overrides default java. Implements java. Doc from java. Replaces the entry for a key only if currently mapped to some value.
This is equivalent to, for this
except that the action is performed atomically.
| |
| size | back to summary |
|---|---|
| public int size() Overrides java. Implements java. Doc from java. Returns the number of key-value mappings in this map. If the
map contains more than
| |
| values | back to summary |
|---|---|
| public Collection Overrides java. Implements java. Doc from java. Returns a
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public boolean |
| Key | back to summary |
|---|---|
| pack-priv Key(Object key, ReferenceQueue<Object> queue) | |
| ackDeath | back to summary |
|---|---|
| public void ackDeath() | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isDead | back to summary |
|---|---|
| public boolean isDead() | |