@GwtCompatible public abstract class ForwardingConcurrentMap<K,V> extends ForwardingMap<K,V> implements ConcurrentMap<K,V>
ForwardingMap.StandardEntrySet, ForwardingMap.StandardKeySet, ForwardingMap.StandardValues
Modifier | Constructor and Description |
---|---|
protected |
ForwardingConcurrentMap()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ConcurrentMap<K,V> |
delegate()
Returns the backing delegate instance that methods are forwarded to.
|
V |
putIfAbsent(K key,
V value)
If the specified key is not already associated
with a value, associate it with the given value.
|
boolean |
remove(Object key,
Object value)
Removes the entry for a key only if currently mapped to a given value.
|
V |
replace(K key,
V value)
Replaces the entry for a key only if currently mapped to some value.
|
boolean |
replace(K key,
V oldValue,
V newValue)
Replaces the entry for a key only if currently mapped to a given value.
|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, standardClear, standardContainsKey, standardContainsValue, standardEquals, standardHashCode, standardIsEmpty, standardPutAll, standardRemove, standardToString, values
toString
protected ForwardingConcurrentMap()
protected abstract ConcurrentMap<K,V> delegate()
ForwardingObject
ForwardingSet.delegate()
. Concrete subclasses override this method to supply
the instance being decorated.delegate
in class ForwardingMap<K,V>
public V putIfAbsent(K key, V value)
java.util.concurrent.ConcurrentMap
if (!map.containsKey(key)) return map.put(key, value); else return map.get(key);except that the action is performed atomically.
putIfAbsent
in interface ConcurrentMap<K,V>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keypublic boolean remove(Object key, Object value)
java.util.concurrent.ConcurrentMap
if (map.containsKey(key) && map.get(key).equals(value)) { map.remove(key); return true; } else return false;except that the action is performed atomically.
remove
in interface ConcurrentMap<K,V>
key
- key with which the specified value is associatedvalue
- value expected to be associated with the specified keypublic V replace(K key, V value)
java.util.concurrent.ConcurrentMap
if (map.containsKey(key)) { return map.put(key, value); } else return null;except that the action is performed atomically.
replace
in interface ConcurrentMap<K,V>
key
- key with which the specified value is associatedvalue
- value to be associated with the specified keypublic boolean replace(K key, V oldValue, V newValue)
java.util.concurrent.ConcurrentMap
if (map.containsKey(key) && map.get(key).equals(oldValue)) { map.put(key, newValue); return true; } else return false;except that the action is performed atomically.
replace
in interface ConcurrentMap<K,V>
key
- key with which the specified value is associatedoldValue
- value expected to be associated with the specified keynewValue
- value to be associated with the specified keyCopyright © 2010-2013. All Rights Reserved.