Class WeakHashMap<K,V>
- All Implemented Interfaces:
Map<K,V>
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all elements from thisMap, leaving it empty.booleancontainsKey(Object key) Returns whether thisMapcontains the specified key.booleancontainsValue(Object value) This method is unsupported in the weak hash mapentrySet()Unsupported operationReturns the value of the mapping with the specified key.booleanisEmpty()Returns whether this map is empty.keySet()Returns a set of the keys contained in thisMap.Maps the specified key to the specified value.voidCopies every mapping in the specifiedMapto thisMap.Removes a mapping with the specified key from thisMap.intsize()Returns the number of mappings in thisMap.values()Unsupported operation
-
Constructor Details
-
WeakHashMap
public WeakHashMap()
-
-
Method Details
-
size
-
isEmpty
-
containsKey
Returns whether this
Mapcontains the specified key.Parameters
key: the key to search for.
Returns
- Specified by:
containsKeyin interfaceMap<K,V> - Returns:
trueif this map contains the specified key,falseotherwise.
-
containsValue
This method is unsupported in the weak hash map- Specified by:
containsValuein interfaceMap<K,V> - Returns:
trueif this map contains the specified value,falseotherwise.
-
get
-
put
Maps the specified key to the specified value.
Parameters
-
key: the key. -
value: the value.
Returns
- Specified by:
putin interfaceMap<K,V> - Returns:
the value of any previous mapping with the specified key or
nullif there was no mapping.Throws
-
UnsupportedOperationException: if adding to thisMapis not supported. -
ClassCastException: @throws ClassCastException if the class of the key or value is inappropriate for thisMap. -
IllegalArgumentException: if the key or value cannot be added to thisMap. -
NullPointerException: @throws NullPointerException if the key or value isnulland thisMapdoes not supportnullkeys or values.
-
-
-
remove
Removes a mapping with the specified key from this
Map.Parameters
key: the key of the mapping to remove.
Returns
-
putAll
Copies every mapping in the specified
Mapto thisMap.Parameters
map: theMapto copy mappings from.
Throws
-
UnsupportedOperationException: if adding to thisMapis not supported. -
ClassCastException: @throws ClassCastException if the class of a key or a value of the specifiedMapis inappropriate for thisMap. -
IllegalArgumentException: if a key or value cannot be added to thisMap. -
NullPointerException: @throws NullPointerException if a key or value isnulland thisMapdoes not supportnullkeys or values.
-
clear
-
keySet
-
values
-
entrySet
-