Package org.supercsv.util
Class ThreeDHashMap<K1,K2,K3,V>
- java.lang.Object
-
- org.supercsv.util.ThreeDHashMap<K1,K2,K3,V>
-
- Type Parameters:
K1
- the first key typeK2
- the second key typeK3
- the third key typeV
- the value type
public class ThreeDHashMap<K1,K2,K3,V> extends java.lang.Object
A 3-dimensional HashMap is a HashMap that enables you to refer to values via three keys rather than one. The underlying implementation is simply a HashMap containing HashMap containing a HashMap, each of which maps to values.- Since:
- 2.0.0 (migrated from Spiffy 0.5)
- Author:
- Kasper B. Graversen
-
-
Constructor Summary
Constructors Constructor Description ThreeDHashMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(K1 firstKey, K2 secondKey)
Existence check of a value (or null) mapped to the keys.boolean
containsKey(K1 firstKey, K2 secondKey, K3 thirdKey)
Existence check of a value (or null) mapped to the keys.java.util.HashMap<K2,java.util.HashMap<K3,V>>
get(K1 firstKey)
Fetch the outermost Hashmap.java.util.HashMap<K3,V>
get(K1 firstKey, K2 secondKey)
Fetch the innermost Hashmap.V
get(K1 firstKey, K2 secondKey, K3 thirdKey)
Fetch a value from the Hashmap.TwoDHashMap<K2,K3,V>
getAs2d(K1 firstKey)
Fetch the outermost Hashmap as a TwoDHashMap.java.util.Set<K1>
keySet()
Returns a set of the keys of the outermost map.java.lang.Object
set(K1 firstKey, K2 secondKey, K3 thirdKey, V value)
Insert a valueint
size()
Returns the number of key-value mappings in this map for the first key.int
size(K1 firstKey)
Returns the number of key-value mappings in this map for the second key.int
size(K1 firstKey, K2 secondKey)
Returns the number of key-value mappings in this map for the third key.
-
-
-
Method Detail
-
containsKey
public boolean containsKey(K1 firstKey, K2 secondKey)
Existence check of a value (or null) mapped to the keys.- Parameters:
firstKey
- first keysecondKey
- second key- Returns:
- true when an element (or null) has been stored with the keys
-
containsKey
public boolean containsKey(K1 firstKey, K2 secondKey, K3 thirdKey)
Existence check of a value (or null) mapped to the keys.- Parameters:
firstKey
- first keysecondKey
- second keythirdKey
- third key- Returns:
- true when an element (or null) has been stored with the keys
-
get
public java.util.HashMap<K2,java.util.HashMap<K3,V>> get(K1 firstKey)
Fetch the outermost Hashmap.- Parameters:
firstKey
- first key- Returns:
- the the innermost hashmap
-
getAs2d
public TwoDHashMap<K2,K3,V> getAs2d(K1 firstKey)
Fetch the outermost Hashmap as a TwoDHashMap.- Parameters:
firstKey
- first key- Returns:
- the the innermost hashmap
-
get
public java.util.HashMap<K3,V> get(K1 firstKey, K2 secondKey)
Fetch the innermost Hashmap.- Parameters:
firstKey
- first keysecondKey
- second key- Returns:
- the the innermost hashmap
-
get
public V get(K1 firstKey, K2 secondKey, K3 thirdKey)
Fetch a value from the Hashmap.- Parameters:
firstKey
- first keysecondKey
- second keythirdKey
- third key- Returns:
- the element or null.
-
set
public java.lang.Object set(K1 firstKey, K2 secondKey, K3 thirdKey, V value)
Insert a value- Parameters:
firstKey
- first keysecondKey
- second keythirdKey
- third keyvalue
- the value to be inserted. null may be inserted as well.- Returns:
- null or the value the insert is replacing.
-
size
public int size()
Returns the number of key-value mappings in this map for the first key.- Returns:
- Returns the number of key-value mappings in this map for the first key.
-
size
public int size(K1 firstKey)
Returns the number of key-value mappings in this map for the second key.- Parameters:
firstKey
- the first key- Returns:
- Returns the number of key-value mappings in this map for the second key.
-
size
public int size(K1 firstKey, K2 secondKey)
Returns the number of key-value mappings in this map for the third key.- Parameters:
firstKey
- the first keysecondKey
- the second key- Returns:
- Returns the number of key-value mappings in this map for the third key.
-
keySet
public java.util.Set<K1> keySet()
Returns a set of the keys of the outermost map.- Returns:
- the key set for the outermost map
-
-