|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
org.cojen.util.ReferencedValueHashMap<K,V>
org.cojen.util.WeakValuedHashMap<K,V>
public class WeakValuedHashMap<K,V>
A Map that weakly references its values and can be used as a simple cache. WeakValuedHashMap is not thread-safe and must be wrapped with Collections.synchronizedMap to be made thread-safe.
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 Summary | |
|---|---|
WeakValuedHashMap()
Constructs a new, empty map with a default capacity and load factor, which is 0.75. |
|
WeakValuedHashMap(int initialCapacity)
Constructs a new, empty map with the specified initial capacity and default load factor, which is 0.75. |
|
WeakValuedHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty map with the specified initial capacity and the specified load factor. |
|
WeakValuedHashMap(Map<? extends K,? extends V> t)
Constructs a new map with the same mappings as the given map. |
|
| Method Summary |
|---|
| Methods inherited from class org.cojen.util.ReferencedValueHashMap |
|---|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, toString, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public WeakValuedHashMap(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity of the HashMap.loadFactor - the load factor of the HashMap
IllegalArgumentException - if the initial capacity is less
than zero, or if the load factor is nonpositive.public WeakValuedHashMap(int initialCapacity)
initialCapacity - the initial capacity of the HashMap.
IllegalArgumentException - if the initial capacity is less
than zero.public WeakValuedHashMap()
public WeakValuedHashMap(Map<? extends K,? extends V> t)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||