Class ForwardingConcurrentMap<K,V>

All Implemented Interfaces:
ConcurrentMap<K,V>, Map<K,V>

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
  • Constructor Details

    • ForwardingConcurrentMap

      protected ForwardingConcurrentMap()
      Constructor for use by subclasses.
  • Method Details

    • delegate

      protected abstract 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 as ForwardingSet.delegate(). Concrete subclasses override this method to supply the instance being decorated.
      Specified by:
      delegate in class ForwardingMap<K,V>
    • putIfAbsent

      @CanIgnoreReturnValue @CheckForNull public V putIfAbsent(K key, V value)
      Specified by:
      putIfAbsent in interface ConcurrentMap<K,V>
      Specified by:
      putIfAbsent in interface Map<K,V>
    • remove

      @CanIgnoreReturnValue public boolean remove(@CheckForNull Object key, @CheckForNull Object value)
      Specified by:
      remove in interface ConcurrentMap<K,V>
      Specified by:
      remove in interface Map<K,V>
    • replace

      @CanIgnoreReturnValue @CheckForNull public V replace(K key, V value)
      Specified by:
      replace in interface ConcurrentMap<K,V>
      Specified by:
      replace in interface Map<K,V>
    • replace

      @CanIgnoreReturnValue public boolean replace(K key, V oldValue, V newValue)
      Specified by:
      replace in interface ConcurrentMap<K,V>
      Specified by:
      replace in interface Map<K,V>