Class ForwardingMap<K,​V>

  • All Implemented Interfaces:
    java.util.Map<K,​V>
    Direct Known Subclasses:
    EnumBiMap, EnumHashBiMap, ForwardingConcurrentMap, ForwardingSortedMap, ImmutableClassToInstanceMap, ImmutableTypeToInstanceMap, MutableClassToInstanceMap, MutableTypeToInstanceMap

    @GwtCompatible
    @Deprecated(since="2022-12-01")
    public abstract class ForwardingMap<K,​V>
    extends ForwardingObject
    implements java.util.Map<K,​V>
    Deprecated.
    The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
    A map which forwards all its method calls to another map. Subclasses should override one or more methods to modify the behavior of the backing map as desired per the decorator pattern.

    Warning: The methods of ForwardingMap forward indiscriminately to the methods of the delegate. For example, overriding put(K, V) alone will not change the behavior of putAll(java.util.Map<? extends K, ? extends V>), which can lead to unexpected behavior. In this case, you should override putAll as well, either providing your own implementation, or delegating to the provided standardPutAll method.

    Each of the standard methods, where appropriate, use Objects.equal(java.lang.Object, java.lang.Object) to test equality for both keys and values. This may not be the desired behavior for map implementations that use non-standard notions of key equality, such as a SortedMap whose comparator is not consistent with equals.

    The standard methods and the collection views they return are not guaranteed to be thread-safe, even when all of the methods that they depend on are thread-safe.

    Since:
    2.0 (imported from Google Collections Library)
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void clear()
      Deprecated.
       
      boolean containsKey​(java.lang.Object key)
      Deprecated.
       
      boolean containsValue​(java.lang.Object value)
      Deprecated.
       
      java.util.Set<java.util.Map.Entry<K,​V>> entrySet()
      Deprecated.
       
      boolean equals​(java.lang.Object object)
      Deprecated.
       
      V get​(java.lang.Object key)
      Deprecated.
       
      int hashCode()
      Deprecated.
       
      boolean isEmpty()
      Deprecated.
       
      java.util.Set<K> keySet()
      Deprecated.
       
      V put​(K key, V value)
      Deprecated.
       
      void putAll​(java.util.Map<? extends K,​? extends V> map)
      Deprecated.
       
      V remove​(java.lang.Object object)
      Deprecated.
       
      int size()
      Deprecated.
       
      java.util.Collection<V> values()
      Deprecated.
       
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Method Detail

      • size

        public int size()
        Deprecated.
        Specified by:
        size in interface java.util.Map<K,​V>
      • isEmpty

        public boolean isEmpty()
        Deprecated.
        Specified by:
        isEmpty in interface java.util.Map<K,​V>
      • remove

        public V remove​(java.lang.Object object)
        Deprecated.
        Specified by:
        remove in interface java.util.Map<K,​V>
      • clear

        public void clear()
        Deprecated.
        Specified by:
        clear in interface java.util.Map<K,​V>
      • containsKey

        public boolean containsKey​(@Nullable
                                   java.lang.Object key)
        Deprecated.
        Specified by:
        containsKey in interface java.util.Map<K,​V>
      • containsValue

        public boolean containsValue​(@Nullable
                                     java.lang.Object value)
        Deprecated.
        Specified by:
        containsValue in interface java.util.Map<K,​V>
      • get

        public V get​(@Nullable
                     java.lang.Object key)
        Deprecated.
        Specified by:
        get in interface java.util.Map<K,​V>
      • put

        public V put​(K key,
                     V value)
        Deprecated.
        Specified by:
        put in interface java.util.Map<K,​V>
      • putAll

        public void putAll​(java.util.Map<? extends K,​? extends V> map)
        Deprecated.
        Specified by:
        putAll in interface java.util.Map<K,​V>
      • keySet

        public java.util.Set<K> keySet()
        Deprecated.
        Specified by:
        keySet in interface java.util.Map<K,​V>
      • values

        public java.util.Collection<V> values()
        Deprecated.
        Specified by:
        values in interface java.util.Map<K,​V>
      • entrySet

        public java.util.Set<java.util.Map.Entry<K,​V>> entrySet()
        Deprecated.
        Specified by:
        entrySet in interface java.util.Map<K,​V>
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object object)
        Deprecated.
        Specified by:
        equals in interface java.util.Map<K,​V>
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Deprecated.
        Specified by:
        hashCode in interface java.util.Map<K,​V>
        Overrides:
        hashCode in class java.lang.Object