Package org.eclipse.net4j.util.ref
Class ReferenceValueMap2<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.eclipse.net4j.util.ref.ReferenceValueMap2<K,V>
- All Implemented Interfaces:
Map<K,V>
- Direct Known Subclasses:
ReferenceValueMap,ReferenceValueMap2.Soft,ReferenceValueMap2.Strong,ReferenceValueMap2.Weak
A
Map implementation that uses KeyedReference instances (KeyedStrongReference,
KeyedSoftReference, KeyedWeakReference or KeyedPhantomReference) as its values.
A ReferenceValueMap can be used to cache mappings until the value of the mapping is no longer
reachable from outside of the map
Note: This map is not synchronized. If it is to be used by multiple threads concurrently the user is responsible for applying proper external synchronization!
- Since:
- 3.3
- Author:
- Eike Stepper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) protected ReferenceQueue<V>protected abstract KeyedReference<K,V> createReference(K key, V value, ReferenceQueue<V> queue) protected Vdereference(KeyedReference<K, V> ref) entrySet()protected intbooleanisEmpty()protected voidprotected voidremoveAll(BiPredicate<K, V> predicate) intsize()Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, keySet, putAll, toString, valuesMethods 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
-
Constructor Details
-
ReferenceValueMap2
public ReferenceValueMap2() -
ReferenceValueMap2
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
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
-
put
-
remove
-
removeAll
- Since:
- 3.16
-
clear
public void clear() -
entrySet
-
createQueue
-
internalPurgeQueue
protected int internalPurgeQueue()- Since:
- 3.7
-
purgeQueue
protected void purgeQueue() -
purged
-
dereference
-
createReference
-