|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap
dsto.dfc.collections.WeakValueHashMap
public class WeakValueHashMap
A hashmap that has weak values in the same way as
WeakHashMap has weak keys.
Original author: Chris Wood
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Field Summary | |
|---|---|
protected Set |
m_entrySet
|
protected Map |
m_hash
|
protected ReferenceQueue |
m_queue
|
| Constructor Summary | |
|---|---|
WeakValueHashMap()
Constructs a new, empty WeakValueHashMap with the
default initial capacity and the default load factor, which is
0.75. |
|
WeakValueHashMap(int initialCapacity)
Constructs a new, empty WeakValueHashMap with the
given initial capacity and the default load factor, which is
0.75. |
|
WeakValueHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty WeakValueHashMap with the
given initial capacity and the given load factor. |
|
WeakValueHashMap(Map t)
Constructs a new WeakValueHashMap with the same
mappings as the specified Map. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all mappings from this map. |
boolean |
containsKey(Object key)
Returns true if this map contains a mapping for
the specified key. |
Set |
entrySet()
Returns a Set view of the mappings in this map. |
Object |
get(Object key)
Returns the value to which this map maps the specified key. |
protected void |
processQueue()
Remove all invalidated entries from the map, that is, remove all entries whose keys have been discarded. |
Object |
put(Object key,
Object value)
Updates this map so that the given key maps to the
given value. |
Object |
remove(Object key)
Removes the mapping for the given key from this
map, if present. |
protected static boolean |
valEquals(Object o1,
Object o2)
|
| Methods inherited from class java.util.AbstractMap |
|---|
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
containsValue, equals, hashCode, isEmpty, keySet, putAll, size, values |
| Field Detail |
|---|
protected final Map m_hash
protected final ReferenceQueue m_queue
protected Set m_entrySet
| Constructor Detail |
|---|
public WeakValueHashMap(int initialCapacity,
float loadFactor)
WeakValueHashMap with the
given initial capacity and the given load factor.
initialCapacity - The initial capacity of the
WeakValueHashMaploadFactor - The load factor of the
WeakValueHashMappublic WeakValueHashMap(int initialCapacity)
WeakValueHashMap with the
given initial capacity and the default load factor, which is
0.75.
initialCapacity - The initial capacity of the
WeakValueHashMappublic WeakValueHashMap()
WeakValueHashMap with the
default initial capacity and the default load factor, which is
0.75.
public WeakValueHashMap(Map t)
WeakValueHashMap with the same
mappings as the specified Map. The
WeakValueHashMap is created with an initial
capacity of twice the number of mappings in the specified map or
11 (whichever is greater), and a default load factor, which is
0.75.
t - the map whose mappings are to be placed in this map.| Method Detail |
|---|
protected void processQueue()
public Set entrySet()
Set view of the mappings in this map.
entrySet in interface MapentrySet in class AbstractMappublic boolean containsKey(Object key)
true if this map contains a mapping for
the specified key.
containsKey in interface MapcontainsKey in class AbstractMapkey - The key whose presence in this map is to be tested.
public Object get(Object key)
key. If this map does not contain a value for
this key, then return null.
get in interface Mapget in class AbstractMapkey - The key whose associated value, if any, is to be
returned
public Object put(Object key,
Object value)
key maps to the
given value. If the map previously contained a
mapping for key then that mapping is replaced and
the previous value is returned.
put in interface Mapput in class AbstractMapkey - The key that is to be mapped to the given
valuevalue - The value to which the given key is
to be mapped
null if if there was no mapping for the
keypublic Object remove(Object key)
key from this
map, if present.
remove in interface Mapremove in class AbstractMapkey - The key whose mapping is to be removed
null if there was no mapping for the keypublic void clear()
clear in interface Mapclear in class AbstractMap
protected static boolean valEquals(Object o1,
Object o2)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||