Package org.apache.cayenne.util
Class SoftValueMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.apache.cayenne.util.SoftValueMap<K,V>
- All Implemented Interfaces:
Serializable,Map<K,V>
public class SoftValueMap<K,V> extends AbstractMap<K,V> implements Serializable
Map that stores values wrapped into
SoftReference- Since:
- 4.1
- See Also:
WeakValueMap, Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object> -
Field Summary
Fields 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,SoftReference<V>>mapThis is a main data storage used for most operationsprotected ReferenceQueue<V>referenceQueue -
Constructor Summary
Constructors Constructor Description SoftValueMap()SoftValueMap(int initialCapacity)SoftValueMap(Map<? extends K,? extends V> m) -
Method Summary
Modifier 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.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
-
SoftValueMap
public SoftValueMap() -
SoftValueMap
public SoftValueMap(int initialCapacity) -
SoftValueMap
-
-
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
-