Class JdkBackedImmutableBiMap<K,V>

java.lang.Object
com.google.common.collect.ImmutableMap<K,V>
com.google.common.collect.ImmutableBiMap<K,V>
com.google.common.collect.JdkBackedImmutableBiMap<K,V>
All Implemented Interfaces:
BiMap<K,V>, Serializable, Map<K,V>

final class JdkBackedImmutableBiMap<K,V> extends ImmutableBiMap<K,V>
Implementation of ImmutableBiMap backed by a pair of JDK HashMaps, which have smartness protecting against hash flooding.
  • Field Details

  • Constructor Details

  • Method Details

    • create

      static <K, V> ImmutableBiMap<K,V> create(int n, Map.Entry<K,V>[] entryArray)
    • size

      public int size()
    • inverse

      public ImmutableBiMap<V,K> inverse()
      Description copied from class: ImmutableBiMap
      Returns the inverse view of this bimap, which maps each of this bimap's values to its associated key. The two bimaps are backed by the same data; any changes to one will appear in the other.

      Note:There is no guaranteed correspondence between the iteration order of a bimap and that of its inverse.

      The inverse of an ImmutableBiMap is another ImmutableBiMap.

      Specified by:
      inverse in interface BiMap<K,V>
      Specified by:
      inverse in class ImmutableBiMap<K,V>
      Returns:
      the inverse view of this bimap
    • get

      @CheckForNull public V get(@CheckForNull Object key)
      Specified by:
      get in interface Map<K,V>
      Specified by:
      get in class ImmutableMap<K,V>
    • createEntrySet

      ImmutableSet<Map.Entry<K,V>> createEntrySet()
      Specified by:
      createEntrySet in class ImmutableMap<K,V>
    • createKeySet

      ImmutableSet<K> createKeySet()
      Specified by:
      createKeySet in class ImmutableMap<K,V>
    • isPartialView

      boolean isPartialView()
      Specified by:
      isPartialView in class ImmutableMap<K,V>
    • writeReplace

      Object writeReplace()
      Description copied from class: ImmutableMap
      Returns a serializable form of this object. Non-public subclasses should not override this method. Publicly-accessible subclasses must override this method and should return a subclass of SerializedForm whose readResolve() method returns objects of the subclass type.
      Overrides:
      writeReplace in class ImmutableBiMap<K,V>