Package org.apache.cayenne.util
Class WeakValueMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.apache.cayenne.util.WeakValueMap<K,V>
- All Implemented Interfaces:
Serializable,Map<K,V>
Map that stores values wrapped into
WeakReference- Since:
- 4.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionThis is a lazily created set of entries that is essentially a view to actual dataprotected HashMap<K, WeakReference<V>> This is a main data storage used for most operationsprotected ReferenceQueue<V> -
Constructor Summary
ConstructorsConstructorDescriptionWeakValueMap(int initialCapacity) WeakValueMap(Map<? extends K, ? extends V> m) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCleanup all references collected by GC so farvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanisEmpty()keySet()voidintsize()values()Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
map
This is a main data storage used for most operations -
referenceQueue
-
entrySet
This is a lazily created set of entries that is essentially a view to actual data
-
-
Constructor Details
-
WeakValueMap
public WeakValueMap() -
WeakValueMap
public WeakValueMap(int initialCapacity) -
WeakValueMap
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceMap<K,V> - Overrides:
sizein classAbstractMap<K,V>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMap<K,V> - Overrides:
isEmptyin classAbstractMap<K,V>
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classAbstractMap<K,V>
-
get
- Specified by:
getin interfaceMap<K,V> - Overrides:
getin classAbstractMap<K,V>
-
put
- Specified by:
putin interfaceMap<K,V> - Overrides:
putin classAbstractMap<K,V>
-
remove
- Specified by:
removein interfaceMap<K,V> - Overrides:
removein classAbstractMap<K,V>
-
putAll
- Specified by:
putAllin interfaceMap<K,V> - Overrides:
putAllin classAbstractMap<K,V>
-
clear
public void clear()- Specified by:
clearin interfaceMap<K,V> - Overrides:
clearin classAbstractMap<K,V>
-
keySet
- Specified by:
keySetin interfaceMap<K,V> - Overrides:
keySetin classAbstractMap<K,V>
-
values
- Specified by:
valuesin interfaceMap<K,V> - Overrides:
valuesin classAbstractMap<K,V>
-
entrySet
- Specified by:
entrySetin interfaceMap<K,V> - Specified by:
entrySetin classAbstractMap<K,V>
-
checkReferenceQueue
protected void checkReferenceQueue()Cleanup all references collected by GC so far
-