Package org.eclipse.net4j.util.ref
Class ReferenceValueMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.eclipse.net4j.util.ref.ReferenceValueMap2<K,V>
org.eclipse.net4j.util.ref.ReferenceValueMap<K,V>
- Type Parameters:
K- the key typeV- the value type
- All Implemented Interfaces:
ConcurrentMap<K,,V> Map<K,V>
- Direct Known Subclasses:
ReferenceValueMap.Soft,ReferenceValueMap.Strong,ReferenceValueMap.Weak
public abstract class ReferenceValueMap<K,V>
extends ReferenceValueMap2<K,V>
implements ConcurrentMap<K,V>
A
ConcurrentMap 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!
- Author:
- Eike Stepper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA reference-value map that keeps values softly reachable.static classA reference-value map that keeps values strongly reachable.static classA reference-value map that keeps values weakly reachable.Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.eclipse.net4j.util.ref.ReferenceValueMap2
clear, containsKey, containsValue, createQueue, createReference, dereference, entrySet, get, internalPurgeQueue, isEmpty, purged, purgeQueue, put, remove, removeAll, sizeMethods 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.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
Constructor Details
-
ReferenceValueMap
public ReferenceValueMap() -
ReferenceValueMap
-
-
Method Details
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V>
-
replace
-
replace
-
remove
-