Class ImmutableMapEntry<K,​V>

  • All Implemented Interfaces:
    java.io.Serializable, java.util.Map.Entry<K,​V>
    Direct Known Subclasses:
    ImmutableMapEntry.NonTerminalImmutableMapEntry

    @GwtIncompatible
    class ImmutableMapEntry<K,​V>
    extends ImmutableEntry<K,​V>
    Implementation of Entry for ImmutableMap that adds extra methods to traverse hash buckets for the key and the value. This allows reuse in RegularImmutableMap and RegularImmutableBiMap, which don't have to recopy the entries created by their Builder implementations.

    This base implementation has no key or value pointers, so instances of ImmutableMapEntry (but not its subclasses) can be reused when copied from one ImmutableMap to another.

    • Constructor Detail

      • ImmutableMapEntry

        ImmutableMapEntry​(K key,
                          V value)
    • Method Detail

      • createEntryArray

        static <K,​V> ImmutableMapEntry<K,​V>[] createEntryArray​(int size)
        Creates an ImmutableMapEntry array to hold parameterized entries. The result must never be upcast back to ImmutableMapEntry[] (or Object[], etc.), or allowed to escape the class.
      • isReusable

        boolean isReusable()
        Returns true if this entry has no bucket links and can safely be reused as a terminal entry in a bucket in another map.