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.Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
static <K,V> Map<K,V> |
copyOf(Map<K,V> m)
Deprecated.
Use
orderedCopyOf(Map) or unorderedCopyOf(Map) instead. |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object o) |
V |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<K> |
keySet() |
static <K,V> Map<K,V> |
orderedCopyOf(Map<K,V> m)
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 MutableOffsetMap<K,V> |
toModifiableMap()
Return an isolated modifiable version of this map.
|
String |
toString() |
static <K,V> Map<K,V> |
unorderedCopyOf(Map<K,V> m)
Create an
ImmutableOffsetMap as a copy of an existing map. |
Collection<V> |
values() |
public abstract MutableOffsetMap<K,V> toModifiableMap()
UnmodifiableMapPhase
toModifiableMap
in interface UnmodifiableMapPhase<K,V>
@Deprecated @Nonnull public static <K,V> Map<K,V> copyOf(@Nonnull Map<K,V> m)
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
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.m
- Input map, may not be null.@Nonnull public static <K,V> Map<K,V> orderedCopyOf(@Nonnull Map<K,V> m)
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
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.m
- Input map, may not be null.@Nonnull public static <K,V> Map<K,V> unorderedCopyOf(@Nonnull Map<K,V> m)
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
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.m
- Input map, may not be null.public final int hashCode()
public final boolean equals(Object o)
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 © 2017 OpenDaylight. All rights reserved.