Class ImmutableOffsetMap<K,​V>

    • Method Detail

      • toModifiableMap

        public abstract @NonNull MutableOffsetMap<K,​V> toModifiableMap()
        Description copied from interface: UnmodifiableMapPhase
        Return an isolated modifiable version of this map. Its mappings must match the mappings present in this map. Any modification of the returned map must not be affect the contents of this map.
        Specified by:
        toModifiableMap in interface UnmodifiableMapPhase<K,​V>
        Returns:
        An modifiable version of this map.
      • orderedCopyOf

        public static <K,​V> @NonNull Map<K,​V> orderedCopyOf​(@NonNull Map<K,​V> map)
        Create an ImmutableOffsetMap as a copy of an existing map. This is actually not completely true, as this method returns an ImmutableMap for empty and singleton inputs, as those are more memory-efficient. This method also recognizes ImmutableOffsetMap and SharedSingletonMap on input, and returns it back without doing anything else. It also recognizes MutableOffsetMap (as returned by toModifiableMap()) and makes an efficient copy of its contents. All other maps are converted to an ImmutableOffsetMap with the same iteration order as input.
        Parameters:
        map - Input map, may not be null.
        Returns:
        An isolated, immutable copy of the input map
        Throws:
        NullPointerException - if map or any of its elements is null.
      • unorderedCopyOf

        public static <K,​V> @NonNull Map<K,​V> unorderedCopyOf​(@NonNull Map<K,​V> map)
        Create an ImmutableOffsetMap as a copy of an existing map. This is actually not completely true, as this method returns an ImmutableMap for empty and singleton inputs, as those are more memory-efficient. This method also recognizes ImmutableOffsetMap and SharedSingletonMap on input, and returns it back without doing anything else. It also recognizes MutableOffsetMap (as returned by toModifiableMap()) and makes an efficient copy of its contents. All other maps are converted to an ImmutableOffsetMap. Iterator order is not guaranteed to be retained.
        Parameters:
        map - Input map, may not be null.
        Returns:
        An isolated, immutable copy of the input map
        Throws:
        NullPointerException - if map or any of its elements is null.
      • size

        public final int size()
        Specified by:
        size in interface Map<K,​V>
      • isEmpty

        public final boolean isEmpty()
        Specified by:
        isEmpty in interface Map<K,​V>
      • containsKey

        public final boolean containsKey​(Object key)
        Specified by:
        containsKey in interface Map<K,​V>
      • containsValue

        public final boolean containsValue​(Object value)
        Specified by:
        containsValue in interface Map<K,​V>
      • get

        public final V get​(Object key)
        Specified by:
        get in interface Map<K,​V>
      • remove

        public final V remove​(Object key)
        Specified by:
        remove in interface Map<K,​V>
      • put

        public final V put​(K key,
                           V value)
        Specified by:
        put in interface Map<K,​V>
      • putAll

        public final void putAll​(Map<? extends K,​? extends V> m)
        Specified by:
        putAll in interface Map<K,​V>
      • clear

        public final void clear()
        Specified by:
        clear in interface Map<K,​V>
      • keySet

        public final Set<K> keySet()
        Specified by:
        keySet in interface Map<K,​V>