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:
ConcurrentMap<K,V>, Map<K, V>
@GwtCompatible
public abstract class ForwardingConcurrentMap<K,V>
extends ForwardingMap<K,V>
implements 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 some
default methods. Specifically, it forwards calls only for methods that existed before
default methods were introduced. For newer methods, like forEach, it inherits
their default implementations. When those implementations invoke methods, they invoke methods on
the ForwardingConcurrentMap.
- Since:
- 2.0
- Author:
- Charles Fry
-
Nested Class Summary
Nested classes/interfaces inherited from class ForwardingMap
ForwardingMap.StandardEntrySet, ForwardingMap.StandardKeySet, ForwardingMap.StandardValuesModifier and TypeClassDescriptionprotected classA sensible implementation ofMap.entrySet()in terms of the following methods:ForwardingMap.clear(),ForwardingMap.containsKey(Object),ForwardingMap.get(Object),ForwardingMap.isEmpty(),ForwardingMap.remove(Object), andForwardingMap.size().protected classA sensible implementation ofMap.keySet()in terms of the following methods:ForwardingMap.clear(),ForwardingMap.containsKey(Object),ForwardingMap.isEmpty(),ForwardingMap.remove(Object),ForwardingMap.size(), and theSet.iterator()method ofForwardingMap.entrySet().protected classA sensible implementation ofMap.values()in terms of the following methods:ForwardingMap.clear(),ForwardingMap.containsValue(Object),ForwardingMap.isEmpty(),ForwardingMap.size(), and theSet.iterator()method ofForwardingMap.entrySet(). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor for use by subclasses. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ConcurrentMap<K, V> delegate()Returns the backing delegate instance that methods are forwarded to.putIfAbsent(K key, V value) booleanbooleanMethods inherited from class ForwardingMap
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, standardClear, standardContainsKey, standardContainsValue, standardEquals, standardHashCode, standardIsEmpty, standardPutAll, standardRemove, standardToString, valuesModifier and TypeMethodDescriptionvoidclear()booleancontainsKey(@Nullable Object key) booleancontainsValue(@Nullable Object value) entrySet()booleaninthashCode()booleanisEmpty()keySet()voidintsize()protected voidA sensible definition ofForwardingMap.clear()in terms of theiteratormethod ofForwardingMap.entrySet().protected booleanA sensible, albeit inefficient, definition ofForwardingMap.containsKey(Object)in terms of theiteratormethod ofForwardingMap.entrySet().protected booleanstandardContainsValue(@Nullable Object value) A sensible definition ofForwardingMap.containsValue(Object)in terms of theiteratormethod ofForwardingMap.entrySet().protected booleanstandardEquals(@Nullable Object object) A sensible definition ofForwardingMap.equals(Object)in terms of theequalsmethod ofForwardingMap.entrySet().protected intA sensible definition ofForwardingMap.hashCode()in terms of theiteratormethod ofForwardingMap.entrySet().protected booleanA sensible definition ofForwardingMap.isEmpty()in terms of theiteratormethod ofForwardingMap.entrySet().protected voidstandardPutAll(Map<? extends K, ? extends V> map) A sensible definition ofForwardingMap.putAll(Map)in terms ofForwardingMap.put(Object, Object).protected VA sensible, albeit inefficient, definition ofForwardingMap.remove(Object)in terms of theiteratormethod ofForwardingMap.entrySet().protected StringA sensible definition ofForwardingObject.toString()in terms of theiteratormethod ofForwardingMap.entrySet().values()Methods inherited from class ForwardingObject
toStringMethods inherited from interface ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
Constructor Details
-
ForwardingConcurrentMap
protected ForwardingConcurrentMap()Constructor for use by subclasses.
-
-
Method Details
-
delegate
Description copied from class:ForwardingObjectReturns 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:
delegatein classForwardingMap<K,V>
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V>
-
remove
-
replace
-
replace
-