K - the type of keys maintained by this templatepublic abstract class ImmutableOffsetMapTemplate<K> extends ImmutableMapTemplate<K>
ImmutableOffsetMap instances with a fixed set of keys. The template can then be
used as a factory for instances via using instantiateTransformed(Map, BiFunction) or, more efficiently,
using instantiateWithValues(Object[]) where the argument array has values ordered corresponding to the key
order defined by keySet().| Modifier and Type | Method and Description |
|---|---|
<T,V> @NonNull ImmutableOffsetMap<K,V> |
instantiateTransformed(Map<K,T> fromMap,
BiFunction<K,T,V> valueTransformer)
Instantiate an immutable map by applying specified
transformer to values of fromMap. |
<V> @NonNull ImmutableOffsetMap<K,V> |
instantiateWithValues(V... values)
Instantiate an immutable map by filling values from provided array.
|
Set<K> |
keySet()
Returns the set of keys expected by this template, in the iteration order Maps resulting from instantiation
will have.
|
static <K> @NonNull ImmutableOffsetMapTemplate<K> |
ordered(Collection<K> keys)
Create a template which produces Maps with specified keys, with iteration order matching the iteration order
of
keys. |
String |
toString() |
static <K> @NonNull ImmutableOffsetMapTemplate<K> |
unordered(Collection<K> keys)
Create a template which produces Maps with specified keys, with unconstrained iteration order.
|
public static <K> @NonNull ImmutableOffsetMapTemplate<K> ordered(Collection<K> keys)
keys. keySet() will return these keys in exactly the same order. The resulting map will
retain insertion order through UnmodifiableMapPhase.toModifiableMap() transformations.K - the type of keys maintained by resulting templatekeys - Keys in requested iteration order.NullPointerException - if keys or any of its elements is nullIllegalArgumentException - if keys is does not have at least two keyspublic static <K> @NonNull ImmutableOffsetMapTemplate<K> unordered(Collection<K> keys)
keySet(). The resulting map will
NOT retain ordering through UnmodifiableMapPhase.toModifiableMap() transformations.K - the type of keys maintained by resulting templatekeys - Keys in any iteration order.NullPointerException - if keys or any of its elements is nullIllegalArgumentException - if keys is does not have at least two keyspublic final Set<K> keySet()
ImmutableMapTemplatekeySet in class ImmutableMapTemplate<K>Map.keySet()public final <T,V> @NonNull ImmutableOffsetMap<K,V> instantiateTransformed(Map<K,T> fromMap, BiFunction<K,T,V> valueTransformer)
ImmutableMapTemplatetransformer 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 ImmutableOffsetMap<K,V> instantiateWithValues(V... values)
ImmutableMapTemplateImmutableMapTemplate.keySet().instantiateWithValues in class ImmutableMapTemplate<K>V - the type of mapped valuesvalues - Values to useCopyright © 2019 OpenDaylight. All rights reserved.