public class WeakHashMap extends AbstractMap implements Map
Constructor and Description |
---|
WeakHashMap() |
WeakHashMap(int initialCapacity) |
WeakHashMap(int initialCapacity,
float loadFactor) |
WeakHashMap(Map map) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all elements from this map, leaving it empty.
|
boolean |
containsKey(Object key)
Returns whether this map contains the specified key.
|
Set |
entrySet()
Returns a set containing all of the mappings in this map.
|
Object |
get(Object key)
Returns the value of the mapping with the specified key.
|
boolean |
isEmpty()
Returns whether this map is empty.
|
Object |
put(Object key,
Object newvalue)
Maps the specified key to the specified value.
|
Object |
remove(Object key)
Removes a mapping with the specified key from this Map.
|
int |
size()
Returns the number of elements in this map.
|
clone, containsValue, equals, hashCode, keySet, putAll, toString, values
public WeakHashMap()
public WeakHashMap(int initialCapacity)
public WeakHashMap(int initialCapacity, float loadFactor)
public WeakHashMap(Map map)
public void clear()
AbstractMap
clear
in interface Map
clear
in class AbstractMap
AbstractMap.isEmpty()
,
AbstractMap.size()
public boolean containsKey(Object key)
AbstractMap
containsKey
in interface Map
containsKey
in class AbstractMap
key
- the key to search for.true
if this map contains the specified key,
false
otherwise.public Set entrySet()
AbstractMap
Map.Entry
. As the set is backed by this map,
changes in one will be reflected in the other.entrySet
in interface Map
entrySet
in class AbstractMap
public Object get(Object key)
AbstractMap
get
in interface Map
get
in class AbstractMap
key
- the key.null
if no mapping for the specified key is found.public boolean isEmpty()
AbstractMap
isEmpty
in interface Map
isEmpty
in class AbstractMap
true
if this map has no elements, false
otherwise.AbstractMap.size()
public Object put(Object key, Object newvalue)
AbstractMap
put
in interface Map
put
in class AbstractMap
key
- the key.newvalue
- the value.null
if there was no mapping.public Object remove(Object key)
AbstractMap
remove
in interface Map
remove
in class AbstractMap
key
- the key of the mapping to remove.null
if no mapping
for the specified key was found.public int size()
AbstractMap
size
in interface Map
size
in class AbstractMap