Class WeakCache
java.lang.Object
java.util.AbstractMap
com.thoughtworks.xstream.core.util.WeakCache
- All Implemented Interfaces:
Map
A HashMap implementation with weak references values and by default for the key. When the
value is garbage collected, the key will also vanish from the map.
- Since:
- 1.4
- Author:
- Jörg Schaible
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) protected ReferencecreateReference(Object value) entrySet()booleaninthashCode()keySet()intsize()toString()values()Methods inherited from class AbstractMap
clone, isEmpty, putAllMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
WeakCache
public WeakCache()Construct a WeakCache with weak keys.Note, that the internally used WeakHashMap is not thread-safe.
- Parameters:
map- the map to use- Since:
- 1.4
-
WeakCache
-
-
Method Details
-
get
-
put
-
remove
-
createReference
-
containsValue
- Specified by:
containsValuein interfaceMap- Overrides:
containsValuein classAbstractMap
-
size
public int size()- Specified by:
sizein interfaceMap- Overrides:
sizein classAbstractMap
-
values
- Specified by:
valuesin interfaceMap- Overrides:
valuesin classAbstractMap
-
entrySet
- Specified by:
entrySetin interfaceMap- Specified by:
entrySetin classAbstractMap
-
containsKey
- Specified by:
containsKeyin interfaceMap- Overrides:
containsKeyin classAbstractMap
-
clear
public void clear()- Specified by:
clearin interfaceMap- Overrides:
clearin classAbstractMap
-
keySet
- Specified by:
keySetin interfaceMap- Overrides:
keySetin classAbstractMap
-
equals
- Specified by:
equalsin interfaceMap- Overrides:
equalsin classAbstractMap
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceMap- Overrides:
hashCodein classAbstractMap
-
toString
- Overrides:
toStringin classAbstractMap
-