Class RegularImmutableMap<K,​V>

    • Field Detail

      • entries

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

        private final transient int mask
      • MAX_LOAD_FACTOR

        private static final double MAX_LOAD_FACTOR
        Closed addressing tends to perform well even with high load factors. Being conservative here ensures that the table is still likely to be relatively sparse (hence it misses fast) while saving space.
        See Also:
        Constant Field Values
    • Constructor Detail

      • RegularImmutableMap

        private RegularImmutableMap​(java.util.Map.Entry<K,​V>[] entries,
                                    ImmutableMapEntry<K,​V>[] table,
                                    int mask)
    • Method Detail

      • fromEntries

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

        static <K,​V> RegularImmutableMap<K,​V> fromEntryArray​(int n,
                                                                         java.util.Map.Entry<K,​V>[] entryArray)
        Creates a RegularImmutableMap from the first n entries in entryArray. This implementation may replace the entries in entryArray with its own entry objects (though they will have the same key/value contents), and may take ownership of entryArray.
      • checkNoConflictInKeyBucket

        static void checkNoConflictInKeyBucket​(java.lang.Object key,
                                               java.util.Map.Entry<?,​?> entry,
                                               @Nullable
                                               ImmutableMapEntry<?,​?> keyBucketHead)
      • get

        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>
      • get

        @Nullable
        static <V> V get​(@Nullable
                         java.lang.Object key,
                         ImmutableMapEntry<?,​V>[] keyTable,
                         int mask)
      • size

        public int size()