K - the type of keys maintained by this mapV - the type of mapped values@Beta public abstract class ImmutableOffsetMap<K,V> extends Object implements UnmodifiableMapPhase<K,V>, Serializable
Map interface which stores a set of immutable mappings using a key-to-offset map and
a backing array. This is useful for situations where the same key set is shared across a multitude of maps, as this
class uses a global cache to share the key-to-offset mapping.
In case the set of keys is statically known, you can use ImmutableOffsetMapTemplate to efficiently create
ImmutableOffsetMap instances.
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
@NonNull Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object obj) |
V |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<K> |
keySet() |
static <K,V> @NonNull Map<K,V> |
orderedCopyOf(@NonNull Map<K,V> map)
Create an
ImmutableOffsetMap as a copy of an existing map. |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> m) |
V |
remove(Object key) |
int |
size() |
abstract @NonNull MutableOffsetMap<K,V> |
toModifiableMap()
Return an isolated modifiable version of this map.
|
String |
toString() |
static <K,V> @NonNull Map<K,V> |
unorderedCopyOf(@NonNull Map<K,V> map)
Create an
ImmutableOffsetMap as a copy of an existing map. |
@NonNull Collection<V> |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic abstract @NonNull MutableOffsetMap<K,V> toModifiableMap()
UnmodifiableMapPhasetoModifiableMap in interface UnmodifiableMapPhase<K,V>public static <K,V> @NonNull Map<K,V> orderedCopyOf(@NonNull Map<K,V> map)
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.map - Input map, may not be null.NullPointerException - if map or any of its elements is null.public static <K,V> @NonNull Map<K,V> unorderedCopyOf(@NonNull Map<K,V> map)
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.map - Input map, may not be null.NullPointerException - if map or any of its elements is null.public final int hashCode()
public final boolean equals(Object obj)
public final boolean containsKey(Object key)
containsKey in interface Map<K,V>public final boolean containsValue(Object value)
containsValue in interface Map<K,V>Copyright © 2019 OpenDaylight. All rights reserved.