Class ImmutableMapWithNullValues<K,​V>

  • Type Parameters:
    K - for key
    V - for victory
    All Implemented Interfaces:
    java.util.Map<K,​V>

    public final class ImmutableMapWithNullValues<K,​V>
    extends java.lang.Object
    implements java.util.Map<K,​V>
    The standard ImmutableMap does not allow null values. The implementation does. We have cases in graphql, around arguments where a map entry can be explicitly set to null and we want immutable smart maps for these cases.
    • 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 Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void clear()
      Deprecated.
      V compute​(K key, java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction)
      Deprecated.
      V computeIfAbsent​(K key, java.util.function.Function<? super K,​? extends V> mappingFunction)
      Deprecated.
      V computeIfPresent​(K key, java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction)
      Deprecated.
      boolean containsKey​(java.lang.Object key)  
      boolean containsValue​(java.lang.Object value)  
      static <K,​V>
      ImmutableMapWithNullValues<K,​V>
      copyOf​(java.util.Map<K,​V> map)  
      static <K,​V>
      ImmutableMapWithNullValues<K,​V>
      emptyMap()  
      java.util.Set<java.util.Map.Entry<K,​V>> entrySet()  
      boolean equals​(java.lang.Object o)  
      void forEach​(java.util.function.BiConsumer<? super K,​? super V> action)  
      V get​(java.lang.Object key)  
      V getOrDefault​(java.lang.Object key, V defaultValue)  
      int hashCode()  
      boolean isEmpty()  
      java.util.Set<K> keySet()  
      V merge​(K key, V value, java.util.function.BiFunction<? super V,​? super V,​? extends V> remappingFunction)
      Deprecated.
      V put​(K key, V value)
      Deprecated.
      void putAll​(java.util.Map<? extends K,​? extends V> m)
      Deprecated.
      V putIfAbsent​(K key, V value)
      Deprecated.
      V remove​(java.lang.Object key)
      Deprecated.
      boolean remove​(java.lang.Object key, java.lang.Object value)
      Deprecated.
      V replace​(K key, V value)
      Deprecated.
      boolean replace​(K key, V oldValue, V newValue)
      Deprecated.
      void replaceAll​(java.util.function.BiFunction<? super K,​? super V,​? extends V> function)
      Deprecated.
      int size()  
      java.lang.String toString()  
      java.util.Collection<V> values()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • size

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public V getOrDefault​(java.lang.Object key,
                              V defaultValue)
        Specified by:
        getOrDefault in interface java.util.Map<K,​V>
      • forEach

        public void forEach​(java.util.function.BiConsumer<? super K,​? super V> action)
        Specified by:
        forEach in interface java.util.Map<K,​V>
      • replaceAll

        @Deprecated
        public void replaceAll​(java.util.function.BiFunction<? super K,​? super V,​? extends V> function)
        Deprecated.
        Specified by:
        replaceAll in interface java.util.Map<K,​V>
      • putIfAbsent

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

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

        @Deprecated
        public boolean replace​(K key,
                               V oldValue,
                               V newValue)
        Deprecated.
        Specified by:
        replace in interface java.util.Map<K,​V>
      • replace

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

        @Deprecated
        public V computeIfAbsent​(K key,
                                 java.util.function.Function<? super K,​? extends V> mappingFunction)
        Deprecated.
        Specified by:
        computeIfAbsent in interface java.util.Map<K,​V>
      • computeIfPresent

        @Deprecated
        public V computeIfPresent​(K key,
                                  java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction)
        Deprecated.
        Specified by:
        computeIfPresent in interface java.util.Map<K,​V>
      • compute

        @Deprecated
        public V compute​(K key,
                         java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction)
        Deprecated.
        Specified by:
        compute in interface java.util.Map<K,​V>
      • merge

        @Deprecated
        public V merge​(K key,
                       V value,
                       java.util.function.BiFunction<? super V,​? super V,​? extends V> remappingFunction)
        Deprecated.
        Specified by:
        merge in interface java.util.Map<K,​V>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object