K
- the key typeV
- the value typepublic final class WeakValueHashMap<K,V> extends AbstractMap<K,V>
Modifier and Type | Class and Description |
---|---|
static interface |
WeakValueHashMap.ValueRef<K,V> |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
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<K,V> t)
Constructs a new
WeakValueHashMap with the same mappings as
the specified Map. |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
protected Map<K,WeakValueHashMap.ValueRef<K,V>> |
createMap()
Create map.
|
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
V |
put(K key,
V value) |
V |
remove(Object key) |
int |
size() |
String |
toString() |
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public WeakValueHashMap(int initialCapacity, float loadFactor)
WeakValueHashMap
with the given
initial capacity and the given load factor.initialCapacity
- The initial capacity of the WeakValueHashMap
loadFactor
- The load factor of the WeakValueHashMap
IllegalArgumentException
- If the initial capacity is less than
zero, or if the load factor is
nonpositivepublic WeakValueHashMap(int initialCapacity)
WeakValueHashMap
with the given
initial capacity and the default load factor, which is
0.75
.initialCapacity
- The initial capacity of the WeakValueHashMap
IllegalArgumentException
- If the initial capacity is less than
zeropublic WeakValueHashMap()
WeakValueHashMap
with the default
initial capacity and the default load factor, which is
0.75
.public WeakValueHashMap(Map<K,V> 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.protected Map<K,WeakValueHashMap.ValueRef<K,V>> createMap()
public int size()
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class AbstractMap<K,V>
public void clear()
public String toString()
toString
in class AbstractMap<K,V>
Copyright © 2020 JBoss, a division of Red Hat. All rights reserved.