Interface ModifiableMapPhase<K,V>

Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values
All Superinterfaces:
Map<K,V>, Mutable
All Known Implementing Classes:
MutableOffsetMap

public interface ModifiableMapPhase<K,V> extends Map<K,V>, Mutable
A Map which can be modified and supports efficient conversion to an unmodifiable map. This interface is the logical counterpart to UnmodifiableMapPhase, but it does not require implementations of toUnmodifiableMap() to return an implementation of that interface. The reason for that empty and singleton mappings are efficiently represented as ImmutableMap, which does not implement UnmodifiableMapPhase.
  • Method Details

    • toUnmodifiableMap

      @NonNull Map<K,V> toUnmodifiableMap()
      Return an isolated unmodifiable version of this map. Returned object must not allow removal, addition or changing of mappings. Its mappings must match the mappings currently present in this map, but must not be affected by any subsequent changes to this map.
      Returns:
      An unmodifiable version of this map.