K
- the type of keys maintained by this mapV
- the type of mapped values@Beta public abstract class MutableOffsetMap<K,V> extends AbstractMap<K,V> implements Cloneable, ModifiableMapPhase<K,V>
ImmutableOffsetMap
. It inherits the set of mappings from the immutable version and
allows updating/removing existing mappings. New mappings are stored in a dedicated LinkedHashMap
to preserve
insertion order. It also tracks the need to duplicate the backing array, so the sequence of
ImmutableOffsetMap<K, V> source;
ImmutableOffsetMap<K, V> result = source.createMutableClone().immutableCopy();
results in source and result sharing the backing objects.
This map does not support null keys nor values.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Method and Description |
---|---|
void |
clear() |
MutableOffsetMap<K,V> |
clone() |
boolean |
containsKey(Object key) |
@NonNull Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object obj) |
V |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
@NonNull Set<K> |
keySet() |
static <K,V> @NonNull MutableOffsetMap<K,V> |
ordered()
Create an empty
MutableOffsetMap which has an iteration order matching the insertion order. |
static <K,V> @NonNull MutableOffsetMap<K,V> |
orderedCopyOf(Map<K,V> map)
Create a
MutableOffsetMap of the specified map, retaining its iteration order. |
V |
put(K key,
V value) |
V |
remove(Object key) |
int |
size() |
@NonNull Map<K,V> |
toUnmodifiableMap()
Return an isolated unmodifiable version of this map.
|
static <K,V> @NonNull MutableOffsetMap<K,V> |
unordered()
Create an empty
MutableOffsetMap which has unspecified iteration order. |
static <K,V> @NonNull MutableOffsetMap<K,V> |
unorderedCopyOf(Map<K,V> map)
Create a
MutableOffsetMap of the specified map, potentially with a different iteration order. |
containsValue, putAll, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, containsValue, forEach, getOrDefault, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, values
public static <K,V> @NonNull MutableOffsetMap<K,V> orderedCopyOf(Map<K,V> map)
MutableOffsetMap
of the specified map, retaining its iteration order.map
- input mapNullPointerException
- if map
is nullpublic static <K,V> @NonNull MutableOffsetMap<K,V> unorderedCopyOf(Map<K,V> map)
MutableOffsetMap
of the specified map, potentially with a different iteration order.map
- input mapNullPointerException
- if map
is nullpublic static <K,V> @NonNull MutableOffsetMap<K,V> ordered()
MutableOffsetMap
which has an iteration order matching the insertion order.public static <K,V> @NonNull MutableOffsetMap<K,V> unordered()
MutableOffsetMap
which has unspecified iteration order.public final int size()
public final boolean isEmpty()
public final boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class AbstractMap<K,V>
public final void clear()
public @NonNull Map<K,V> toUnmodifiableMap()
ModifiableMapPhase
toUnmodifiableMap
in interface ModifiableMapPhase<K,V>
public MutableOffsetMap<K,V> clone()
clone
in class AbstractMap<K,V>
public final int hashCode()
public final boolean equals(Object obj)
Copyright © 2019 OpenDaylight. All rights reserved.