org.jboss.util.collection
Class WeakValueHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.jboss.util.collection.WeakValueHashMap<K,V>
- Type Parameters:
K - the key typeV - the value type
- All Implemented Interfaces:
- Map<K,V>
public class WeakValueHashMap<K,V>
- extends AbstractMap<K,V>
This Map will remove entries when the value in the map has been
cleaned from garbage collection
- Version:
- $Revision: 2517 $
- Author:
- Bill Burke, Adrian Brock
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
|
Constructor Summary |
WeakValueHashMap()
Constructs a new, empty WeakHashMap with the default
initial capacity and the default load factor, which is
0.75. |
WeakValueHashMap(int initialCapacity)
Constructs a new, empty WeakHashMap with the given
initial capacity and the default load factor, which is
0.75. |
WeakValueHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty WeakHashMap with the given
initial capacity and the given load factor. |
WeakValueHashMap(Map<K,V> t)
Constructs a new WeakHashMap with the same mappings as the
specified Map. |
WeakValueHashMap
public WeakValueHashMap(int initialCapacity,
float loadFactor)
- Constructs a new, empty
WeakHashMap with the given
initial capacity and the given load factor.
- Parameters:
initialCapacity - The initial capacity of the
WeakHashMaploadFactor - The load factor of the WeakHashMap
- Throws:
IllegalArgumentException - If the initial capacity is less than
zero, or if the load factor is
nonpositive
WeakValueHashMap
public WeakValueHashMap(int initialCapacity)
- Constructs a new, empty
WeakHashMap with the given
initial capacity and the default load factor, which is
0.75.
- Parameters:
initialCapacity - The initial capacity of the
WeakHashMap
- Throws:
IllegalArgumentException - If the initial capacity is less than
zero
WeakValueHashMap
public WeakValueHashMap()
- Constructs a new, empty
WeakHashMap with the default
initial capacity and the default load factor, which is
0.75.
WeakValueHashMap
public WeakValueHashMap(Map<K,V> t)
- Constructs a new
WeakHashMap with the same mappings as the
specified Map. The WeakHashMap 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.
- Parameters:
t - the map whose mappings are to be placed in this map.- Since:
- 1.3
size
public int size()
- Specified by:
size in interface Map<K,V>- Overrides:
size in class AbstractMap<K,V>
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey in interface Map<K,V>- Overrides:
containsKey in class AbstractMap<K,V>
get
public V get(Object key)
- Specified by:
get in interface Map<K,V>- Overrides:
get in class AbstractMap<K,V>
put
public V put(K key,
V value)
- Specified by:
put in interface Map<K,V>- Overrides:
put in class AbstractMap<K,V>
remove
public V remove(Object key)
- Specified by:
remove in interface Map<K,V>- Overrides:
remove in class AbstractMap<K,V>
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Specified by:
entrySet in interface Map<K,V>- Specified by:
entrySet in class AbstractMap<K,V>
clear
public void clear()
- Specified by:
clear in interface Map<K,V>- Overrides:
clear in class AbstractMap<K,V>
Copyright © 2008 JBoss Inc.. All Rights Reserved.