K
- the type of keys maintained by this templatepublic abstract class SharedSingletonMapTemplate<K> extends ImmutableMapTemplate<K>
SharedSingletonMap
instances with a fixed key. The template can then be
used as a factory for instances via using instantiateTransformed(Map, BiFunction)
or, more efficiently,
using instantiateWithValue(Object)
.Modifier and Type | Method and Description |
---|---|
<T,V> @NonNull SharedSingletonMap<K,V> |
instantiateTransformed(Map<K,T> fromMap,
BiFunction<K,T,V> valueTransformer)
Instantiate an immutable map by applying specified
transformer to values of fromMap . |
abstract <V> @NonNull SharedSingletonMap<K,V> |
instantiateWithValue(V value)
Instantiate an immutable map with the value supplied.
|
<V> @NonNull SharedSingletonMap<K,V> |
instantiateWithValues(V... values)
Instantiate an immutable map by filling values from provided array.
|
SingletonSet<K> |
keySet()
Returns the set of keys expected by this template, in the iteration order Maps resulting from instantiation
will have.
|
static <K> @NonNull SharedSingletonMapTemplate<K> |
ordered(K key)
Create a template which produces Maps with specified key.
|
String |
toString() |
static <K> @NonNull SharedSingletonMapTemplate<K> |
unordered(K key)
Create a template which produces Maps with specified key.
|
public static <K> @NonNull SharedSingletonMapTemplate<K> ordered(K key)
UnmodifiableMapPhase.toModifiableMap()
transformations.K
- the type of keys maintained by resulting templatekey
- Single key in resulting mapNullPointerException
- if key
is nullpublic static <K> @NonNull SharedSingletonMapTemplate<K> unordered(K key)
UnmodifiableMapPhase.toModifiableMap()
transformations.K
- the type of keys maintained by resulting templatekey
- Single key in resulting mapNullPointerException
- if key
is nullpublic final SingletonSet<K> keySet()
ImmutableMapTemplate
keySet
in class ImmutableMapTemplate<K>
Map.keySet()
public final <T,V> @NonNull SharedSingletonMap<K,V> instantiateTransformed(Map<K,T> fromMap, BiFunction<K,T,V> valueTransformer)
ImmutableMapTemplate
transformer
to values of fromMap
.instantiateTransformed
in class ImmutableMapTemplate<K>
T
- the type of input valuesV
- the type of mapped valuesfromMap
- Input mapvalueTransformer
- Transformation to apply to values@SafeVarargs public final <V> @NonNull SharedSingletonMap<K,V> instantiateWithValues(V... values)
ImmutableMapTemplate
ImmutableMapTemplate.keySet()
.instantiateWithValues
in class ImmutableMapTemplate<K>
V
- the type of mapped valuesvalues
- Values to usepublic abstract <V> @NonNull SharedSingletonMap<K,V> instantiateWithValue(V value)
V
- the type of mapped valuesvalue
- Value to useNullPointerException
- if value
is nullCopyright © 2019 OpenDaylight. All rights reserved.