Class UnmodifiableIdentityHashMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.IdentityHashMap<K,V>
org.plumelib.util.UnmodifiableIdentityHashMap<K,V>
Type Parameters:
K - the type of keys of the map
V - the type of values of the map
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>

public class UnmodifiableIdentityHashMap<K,V> extends IdentityHashMap<K,V>
A wrapper around an IdentityHashMap that makes it unmodifiable. All mutating operations throw UnsupportedOperationException, and all other operations delegate to the underlying map.

This class extends IdentityHashMap only so it is assignable to variables / fields of static type IdentityHashMap. All valid operations are delegated to the wrapped map, and any inherited state from the superclass is unused.

See Also:
  • Method Details

    • wrap

      public static <K, V> UnmodifiableIdentityHashMap<K,V> wrap(IdentityHashMap<K,V> map)
      Create an UnmodifiableIdentityHashMap wrapper for a map. Returns the argument if it is already an UnmodifiableIdentityHashMap.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      map - the map to wrap
      Returns:
      the wrapper
    • size

      public @org.checkerframework.checker.index.qual.NonNegative int size(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this)
      Specified by:
      size in interface Map<K,V>
      Overrides:
      size in class IdentityHashMap<K,V>
    • isEmpty

      public boolean isEmpty(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this)
      Specified by:
      isEmpty in interface Map<K,V>
      Overrides:
      isEmpty in class IdentityHashMap<K,V>
    • get

      public @Nullable V get(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this, @GuardSatisfied @Nullable @UnknownSignedness Object key)
      Specified by:
      get in interface Map<K,V>
      Overrides:
      get in class IdentityHashMap<K,V>
    • containsKey

      public boolean containsKey(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this, @GuardSatisfied @Nullable @UnknownSignedness Object key)
      Specified by:
      containsKey in interface Map<K,V>
      Overrides:
      containsKey in class IdentityHashMap<K,V>
    • containsValue

      public boolean containsValue(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this, @GuardSatisfied @Nullable @UnknownSignedness Object value)
      Specified by:
      containsValue in interface Map<K,V>
      Overrides:
      containsValue in class IdentityHashMap<K,V>
    • put

      public @Nullable V put(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this, K key, V value)
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class IdentityHashMap<K,V>
    • putAll

      public void putAll(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this, Map<? extends K,? extends V> m)
      Specified by:
      putAll in interface Map<K,V>
      Overrides:
      putAll in class IdentityHashMap<K,V>
    • remove

      public @Nullable V remove(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this, @GuardSatisfied @Nullable @UnknownSignedness Object key)
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class IdentityHashMap<K,V>
    • clear

      public void clear(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this)
      Specified by:
      clear in interface Map<K,V>
      Overrides:
      clear in class IdentityHashMap<K,V>
    • equals

      public boolean equals(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this, @Nullable @GuardSatisfied Object o)
      Specified by:
      equals in interface Map<K,V>
      Overrides:
      equals in class IdentityHashMap<K,V>
    • hashCode

      public int hashCode(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this)
      Specified by:
      hashCode in interface Map<K,V>
      Overrides:
      hashCode in class IdentityHashMap<K,V>
    • keySet

      public Set<K> keySet(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this)
      Specified by:
      keySet in interface Map<K,V>
      Overrides:
      keySet in class IdentityHashMap<K,V>
    • values

      public Collection<V> values(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this)
      Specified by:
      values in interface Map<K,V>
      Overrides:
      values in class IdentityHashMap<K,V>
    • entrySet

      public Set<Map.Entry<K,V>> entrySet(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this)
      Specified by:
      entrySet in interface Map<K,V>
      Overrides:
      entrySet in class IdentityHashMap<K,V>
    • forEach

      public void forEach(BiConsumer<? super K,? super V> action)
      Specified by:
      forEach in interface Map<K,V>
      Overrides:
      forEach in class IdentityHashMap<K,V>
    • replaceAll

      public void replaceAll(BiFunction<? super K,? super V,? extends V> function)
      Specified by:
      replaceAll in interface Map<K,V>
      Overrides:
      replaceAll in class IdentityHashMap<K,V>
    • toString

      public String toString(@GuardSatisfied UnmodifiableIdentityHashMap<K,V> this)
      Overrides:
      toString in class AbstractMap<K,V>
    • getOrDefault

      public V getOrDefault(@GuardSatisfied @UnknownSignedness Object key, V defaultValue)
    • putIfAbsent

      public V putIfAbsent(K key, V value)
    • remove

      public boolean remove(@GuardSatisfied @UnknownSignedness Object key, @GuardSatisfied @UnknownSignedness Object value)
    • replace

      public boolean replace(K key, V oldValue, V newValue)
    • replace

      public V replace(K key, V value)
    • computeIfAbsent

      public @PolyNull V computeIfAbsent(K key, Function<? super K,? extends @PolyNull V> mappingFunction)
    • computeIfPresent

      public @PolyNull V computeIfPresent(K key, BiFunction<? super K,? super V,? extends @PolyNull V> remappingFunction)
    • compute

      public @PolyNull V compute(K key, BiFunction<? super K,? super V,? extends @PolyNull V> remappingFunction)
    • merge

      public @PolyNull V merge(K key, V value, BiFunction<? super V,? super V,? extends @PolyNull V> remappingFunction)