|
||||||||||
| 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.SoftValuedHashMap<K,V>
public class SoftValuedHashMap<K,V>
A Map that softly references its values and can be used as a simple cache. SoftValuedHashMap is not thread-safe and must be wrapped with Collections.synchronizedMap to be made thread-safe.
Note: Softly 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 | |
|---|---|
SoftValuedHashMap()
Constructs a new, empty map with a default capacity and load factor, which is 0.75. |
|
SoftValuedHashMap(int initialCapacity)
Constructs a new, empty map with the specified initial capacity and default load factor, which is 0.75. |
|
SoftValuedHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty map with the specified initial capacity and the specified load factor. |
|
SoftValuedHashMap(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 SoftValuedHashMap(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 SoftValuedHashMap(int initialCapacity)
initialCapacity - the initial capacity of the HashMap.
IllegalArgumentException - if the initial capacity is less
than zero.public SoftValuedHashMap()
public SoftValuedHashMap(Map<? extends K,? extends V> t)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||