public abstract class ReferenceValueMap<K,V> extends ReferenceValueMap2<K,V> implements ConcurrentMap<K,V>
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!
Modifier and Type | Class and Description |
---|---|
static class |
ReferenceValueMap.Soft<K,V> |
static class |
ReferenceValueMap.Strong<K,V> |
static class |
ReferenceValueMap.Weak<K,V> |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
ReferenceValueMap() |
ReferenceValueMap(ConcurrentMap<K,KeyedReference<K,V>> map) |
Modifier and Type | Method and Description |
---|---|
V |
putIfAbsent(K key,
V value) |
boolean |
remove(Object key,
Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
clear, containsKey, containsValue, createQueue, createReference, dereference, entrySet, get, isEmpty, purged, purgeQueue, put, remove, size
clone, equals, hashCode, keySet, putAll, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
public ReferenceValueMap()
public ReferenceValueMap(ConcurrentMap<K,KeyedReference<K,V>> map)
Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html