Q
- Key array typeV
- Value typepublic class NDimensionalHashMap<Q,V> extends HashMap<Q[],V>
You are able to query for an exact match using get(Object)
or
instead query with a single property or collection of partially-matching properties
in order to get relevant entries. See the following:
getAnyMatching(Object[])
getEntries(Object[])
getEntries(Object,
int)
Remember that the N-Dimensional HashMap requires an explicit number of dimensions in order to configure the correct property array. All property key entries must be of the same length. Use null-values as individual array members if properties are unknown.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
NDimensionalHashMap(int dimensions)
|
Modifier and Type | Method and Description |
---|---|
V |
get(Object key)
Retrieve a single value based on an exact match.
|
@NotNull Collection<V> |
getAnyMatching(Q[] properties)
|
int |
getDimensions()
|
@NotNull Collection<V> |
getEntries(Q[] properties)
|
@NotNull Collection<V> |
getEntries(Q property,
int position)
|
V |
getOrDefault(Object key,
V defaultValue)
|
V |
put(Q[] key,
V value)
|
void |
putAll(Map<? extends Q[],? extends V> m)
|
V |
putIfAbsent(Q[] key,
V value)
|
V |
replace(Q[] key,
V value)
|
boolean |
replace(Q[] key,
V oldValue,
V newValue)
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, isEmpty, keySet, merge, remove, remove, replaceAll, size, values
equals, hashCode, toString
public V getOrDefault(Object key, V defaultValue)
getOrDefault
in
interface Map<Q[],V>
getOrDefault
in
class HashMap<Q[],V>
public V putIfAbsent(Q[] key, V value)
putIfAbsent
in
interface Map<Q[],V>
putIfAbsent
in class HashMap<Q[],V>
public int getDimensions()
@NotNull public @NotNull Collection<V> getEntries(Q property, int position)
@NotNull public @NotNull Collection<V> getEntries(Q[] properties)
@NotNull public @NotNull Collection<V> getAnyMatching(Q[] properties)
Copyright © 2020. All rights reserved.