Package com.google.common.collect
Class ForwardingConcurrentMap<K,V>
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- com.google.common.collect.ForwardingMap<K,V>
-
- com.google.common.collect.ForwardingConcurrentMap<K,V>
-
- All Implemented Interfaces:
java.util.concurrent.ConcurrentMap<K,V>
,java.util.Map<K,V>
@GwtCompatible public abstract class ForwardingConcurrentMap<K,V> extends ForwardingMap<K,V> implements java.util.concurrent.ConcurrentMap<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.default
method warning: This class forwards calls to only somedefault
methods. Specifically, it forwards calls only for methods that existed beforedefault
methods were introduced. For newer methods, likeforEach
, it inherits their default implementations. When those implementations invoke methods, they invoke methods on theForwardingConcurrentMap
.- Since:
- 2.0
- Author:
- Charles Fry
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.collect.ForwardingMap
ForwardingMap.StandardEntrySet, ForwardingMap.StandardKeySet, ForwardingMap.StandardValues
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForwardingConcurrentMap()
Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.util.concurrent.ConcurrentMap<K,V>
delegate()
Returns the backing delegate instance that methods are forwarded to.V
putIfAbsent(K key, V value)
boolean
remove(java.lang.Object key, java.lang.Object value)
V
replace(K key, V value)
boolean
replace(K key, V oldValue, V newValue)
-
Methods inherited from class com.google.common.collect.ForwardingMap
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, standardClear, standardContainsKey, standardContainsValue, standardEquals, standardHashCode, standardIsEmpty, standardPutAll, standardRemove, standardToString, 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
-
-
-
-
Constructor Detail
-
ForwardingConcurrentMap
protected ForwardingConcurrentMap()
Constructor for use by subclasses.
-
-
Method Detail
-
delegate
protected abstract java.util.concurrent.ConcurrentMap<K,V> delegate()
Description copied from class:ForwardingObject
Returns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such asForwardingSet.delegate()
. Concrete subclasses override this method to supply the instance being decorated.- Specified by:
delegate
in classForwardingMap<K,V>
-
putIfAbsent
@CanIgnoreReturnValue @CheckForNull public V putIfAbsent(K key, V value)
-
remove
@CanIgnoreReturnValue public boolean remove(@CheckForNull java.lang.Object key, @CheckForNull java.lang.Object value)
-
replace
@CanIgnoreReturnValue @CheckForNull public V replace(K key, V value)
-
-