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
Modifier and TypeClassDescriptionstatic class
static class
static class
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> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) protected ReferenceQueue<V>
protected abstract KeyedReference<K,
V> createReference
(K key, V value, ReferenceQueue<V> queue) protected V
dereference
(KeyedReference<K, V> ref) entrySet()
protected int
boolean
isEmpty()
protected void
protected void
removeAll
(BiPredicate<K, V> predicate) int
size()
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, keySet, putAll, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V> - Overrides:
containsValue
in 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
-