K
- the type of keys maintained by this mapV
- the type of mapped values@Beta public abstract class SharedSingletonMap<K,V> extends Object implements Serializable, UnmodifiableMapPhase<K,V>
Map
interface which stores a single mapping. The key set is shared among all instances
which contain the same key. This implementation does not support null keys or values.
In case the set of keys is statically known, you can use SharedSingletonMapTemplate
to efficiently create
SharedSingletonMap
instances.
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
@NonNull SingletonSet<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object obj) |
V |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
@NonNull SingletonSet<K> |
keySet() |
static <K,V> @NonNull SharedSingletonMap<K,V> |
orderedCopyOf(Map<K,V> map)
Create a
SharedSingletonMap of specified key and value , which retains insertion order
when transformed via UnmodifiableMapPhase.toModifiableMap() . |
static <K,V> @NonNull SharedSingletonMap<K,V> |
orderedOf(K key,
V value)
Create a
SharedSingletonMap of specified key and value , which retains insertion order
when transformed via UnmodifiableMapPhase.toModifiableMap() . |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> m) |
V |
remove(Object key) |
int |
size() |
String |
toString() |
static <K,V> @NonNull SharedSingletonMap<K,V> |
unorderedCopyOf(Map<K,V> map)
Create a
SharedSingletonMap from specified single-element map, which does not retain insertion order when
transformed via UnmodifiableMapPhase.toModifiableMap() . |
static <K,V> @NonNull SharedSingletonMap<K,V> |
unorderedOf(K key,
V value)
Create a
SharedSingletonMap of specified key and value , which does not retain insertion
order when transformed via UnmodifiableMapPhase.toModifiableMap() . |
@NonNull SingletonSet<V> |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
toModifiableMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public static <K,V> @NonNull SharedSingletonMap<K,V> orderedOf(K key, V value)
SharedSingletonMap
of specified key
and value
, which retains insertion order
when transformed via UnmodifiableMapPhase.toModifiableMap()
.key
- keyvalue
- valueNullPointerException
- if any of the arguments is nullpublic static <K,V> @NonNull SharedSingletonMap<K,V> unorderedOf(K key, V value)
SharedSingletonMap
of specified key
and value
, which does not retain insertion
order when transformed via UnmodifiableMapPhase.toModifiableMap()
.key
- keyvalue
- valueNullPointerException
- if any of the arguments is nullpublic static <K,V> @NonNull SharedSingletonMap<K,V> orderedCopyOf(Map<K,V> map)
SharedSingletonMap
of specified key
and value
, which retains insertion order
when transformed via UnmodifiableMapPhase.toModifiableMap()
.map
- input mapNullPointerException
- if map
is nullIllegalArgumentException
- if map
does not have exactly one entrypublic static <K,V> @NonNull SharedSingletonMap<K,V> unorderedCopyOf(Map<K,V> map)
SharedSingletonMap
from specified single-element map, which does not retain insertion order when
transformed via UnmodifiableMapPhase.toModifiableMap()
.map
- input mapNullPointerException
- if map
is nullIllegalArgumentException
- if map
does not have exactly one entrypublic final @NonNull SingletonSet<Map.Entry<K,V>> entrySet()
public final boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public final boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public final int hashCode()
public final boolean equals(Object obj)
Copyright © 2019 OpenDaylight. All rights reserved.