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>
public class WeakValueMap<K,V> extends AbstractMap<K,V> implements Serializable
Map that stores values wrapped into 
WeakReference- Since:
- 4.1
- See Also:
- SoftValueMap, Serialized Form
- 
Nested Class SummaryNested classes/interfaces inherited from class java.util.AbstractMapAbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
- 
Field SummaryFields Modifier and Type Field Description protected Set<Map.Entry<K,V>>entrySetThis is a lazily created set of entries that is essentially a view to actual dataprotected HashMap<K,WeakReference<V>>mapThis is a main data storage used for most operationsprotected ReferenceQueue<V>referenceQueue
- 
Constructor SummaryConstructors Constructor Description WeakValueMap()WeakValueMap(int initialCapacity)WeakValueMap(Map<? extends K,? extends V> m)
- 
Method SummaryModifier and Type Method Description protected voidcheckReferenceQueue()Cleanup all references collected by GC so farvoidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<K,V>>entrySet()Vget(Object key)booleanisEmpty()Set<K>keySet()Vput(K key, V value)voidputAll(Map<? extends K,? extends V> m)Vremove(Object key)intsize()Collection<V>values()Methods inherited from class java.util.AbstractMapclone, equals, hashCode, toStringMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Mapcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
- 
Field Details- 
mapThis is a main data storage used for most operations
- 
referenceQueue
- 
entrySetThis is a lazily created set of entries that is essentially a view to actual data
 
- 
- 
Constructor Details- 
WeakValueMappublic WeakValueMap()
- 
WeakValueMappublic WeakValueMap(int initialCapacity)
- 
WeakValueMap
 
- 
- 
Method Details- 
sizepublic int size()- Specified by:
- sizein interface- Map<K,V>
- Overrides:
- sizein class- AbstractMap<K,V>
 
- 
isEmptypublic boolean isEmpty()- Specified by:
- isEmptyin interface- Map<K,V>
- Overrides:
- isEmptyin class- AbstractMap<K,V>
 
- 
containsKey- Specified by:
- containsKeyin interface- Map<K,V>
- Overrides:
- containsKeyin class- AbstractMap<K,V>
 
- 
containsValue- Specified by:
- containsValuein interface- Map<K,V>
- Overrides:
- containsValuein class- AbstractMap<K,V>
 
- 
get- Specified by:
- getin interface- Map<K,V>
- Overrides:
- getin class- AbstractMap<K,V>
 
- 
put- Specified by:
- putin interface- Map<K,V>
- Overrides:
- putin class- AbstractMap<K,V>
 
- 
remove- Specified by:
- removein interface- Map<K,V>
- Overrides:
- removein class- AbstractMap<K,V>
 
- 
putAll- Specified by:
- putAllin interface- Map<K,V>
- Overrides:
- putAllin class- AbstractMap<K,V>
 
- 
clearpublic void clear()- Specified by:
- clearin interface- Map<K,V>
- Overrides:
- clearin class- AbstractMap<K,V>
 
- 
keySet- Specified by:
- keySetin interface- Map<K,V>
- Overrides:
- keySetin class- AbstractMap<K,V>
 
- 
values- Specified by:
- valuesin interface- Map<K,V>
- Overrides:
- valuesin class- AbstractMap<K,V>
 
- 
entrySet- Specified by:
- entrySetin interface- Map<K,V>
- Specified by:
- entrySetin class- AbstractMap<K,V>
 
- 
checkReferenceQueueprotected void checkReferenceQueue()Cleanup all references collected by GC so far
 
-