Class RegularImmutableBiMap<K,​V>

    • Field Detail

      • entries

        private final transient java.util.Map.Entry<K,​V>[] entries
      • mask

        private final transient int mask
      • hashCode

        private final transient int hashCode
    • Constructor Detail

      • RegularImmutableBiMap

        private RegularImmutableBiMap​(ImmutableMapEntry<K,​V>[] keyTable,
                                      ImmutableMapEntry<K,​V>[] valueTable,
                                      java.util.Map.Entry<K,​V>[] entries,
                                      int mask,
                                      int hashCode)
    • Method Detail

      • fromEntries

        static <K,​V> RegularImmutableBiMap<K,​V> fromEntries​(java.util.Map.Entry<K,​V>... entries)
      • fromEntryArray

        static <K,​V> RegularImmutableBiMap<K,​V> fromEntryArray​(int n,
                                                                           java.util.Map.Entry<K,​V>[] entryArray)
      • checkNoConflictInValueBucket

        private static void checkNoConflictInValueBucket​(java.lang.Object value,
                                                         java.util.Map.Entry<?,​?> entry,
                                                         @Nullable
                                                         ImmutableMapEntry<?,​?> valueBucketHead)
      • get

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

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Map<K,​V>
        Overrides:
        hashCode in class ImmutableMap<K,​V>
      • 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