|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.collect.ForwardingObject com.google.common.collect.ForwardingMap<K,V> com.google.common.collect.ForwardingConcurrentMap<K,V>
public abstract class ForwardingConcurrentMap<K,V>
A concurrent map which forwards all its method calls to another concurrent map. Subclasses should override one or more methods to modify the behavior of the backing map as desired per the decorator pattern.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
protected |
ForwardingConcurrentMap()
Constructor for use by subclasses. |
Method Summary | |
---|---|
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. |
Methods inherited from class com.google.common.collect.ForwardingMap |
---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class com.google.common.collect.ForwardingObject |
---|
toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Constructor Detail |
---|
protected ForwardingConcurrentMap()
Method Detail |
---|
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 key
public 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 key
public 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 key
public 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 key
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |