public final class HMap extends Object implements Iterable<Tuple2<TypeSafeKey<?,?>,Object>>
TypeSafeKey,
HList| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(TypeSafeKey<?,?> key)
Determine if a key is mapped.
|
<V> V |
demand(TypeSafeKey<?,V> key)
Retrieve the value at this key, throwing a
NoSuchElementException if this key is unmapped. |
static HMap |
emptyHMap()
Static factory method for creating an empty HMap.
|
boolean |
equals(Object other) |
<A,B> Maybe<B> |
get(TypeSafeKey<A,B> key)
Retrieve the value at this key.
|
int |
hashCode() |
static <V1,V2> HMap |
hMap(TypeSafeKey<?,V1> key1,
V1 value1,
TypeSafeKey<?,V2> key2,
V2 value2)
Static factory method for creating an HMap from two given associations.
|
static <V1,V2,V3> HMap |
hMap(TypeSafeKey<?,V1> key1,
V1 value1,
TypeSafeKey<?,V2> key2,
V2 value2,
TypeSafeKey<?,V3> key3,
V3 value3)
Static factory method for creating an HMap from three given associations.
|
static <V1,V2,V3,V4> |
hMap(TypeSafeKey<?,V1> key1,
V1 value1,
TypeSafeKey<?,V2> key2,
V2 value2,
TypeSafeKey<?,V3> key3,
V3 value3,
TypeSafeKey<?,V4> key4,
V4 value4)
Static factory method for creating an HMap from four given associations.
|
static <V1,V2,V3,V4,V5> |
hMap(TypeSafeKey<?,V1> key1,
V1 value1,
TypeSafeKey<?,V2> key2,
V2 value2,
TypeSafeKey<?,V3> key3,
V3 value3,
TypeSafeKey<?,V4> key4,
V4 value4,
TypeSafeKey<?,V5> key5,
V5 value5)
Static factory method for creating an HMap from five given associations.
|
static <V1,V2,V3,V4,V5,V6> |
hMap(TypeSafeKey<?,V1> key1,
V1 value1,
TypeSafeKey<?,V2> key2,
V2 value2,
TypeSafeKey<?,V3> key3,
V3 value3,
TypeSafeKey<?,V4> key4,
V4 value4,
TypeSafeKey<?,V5> key5,
V5 value5,
TypeSafeKey<?,V6> key6,
V6 value6)
Static factory method for creating an HMap from six given associations.
|
static <V1,V2,V3,V4,V5,V6,V7> |
hMap(TypeSafeKey<?,V1> key1,
V1 value1,
TypeSafeKey<?,V2> key2,
V2 value2,
TypeSafeKey<?,V3> key3,
V3 value3,
TypeSafeKey<?,V4> key4,
V4 value4,
TypeSafeKey<?,V5> key5,
V5 value5,
TypeSafeKey<?,V6> key6,
V6 value6,
TypeSafeKey<?,V7> key7,
V7 value7)
Static factory method for creating an HMap from seven given associations.
|
static <V1,V2,V3,V4,V5,V6,V7,V8> |
hMap(TypeSafeKey<?,V1> key1,
V1 value1,
TypeSafeKey<?,V2> key2,
V2 value2,
TypeSafeKey<?,V3> key3,
V3 value3,
TypeSafeKey<?,V4> key4,
V4 value4,
TypeSafeKey<?,V5> key5,
V5 value5,
TypeSafeKey<?,V6> key6,
V6 value6,
TypeSafeKey<?,V7> key7,
V7 value7,
TypeSafeKey<?,V8> key8,
V8 value8)
Static factory method for creating an HMap from eight given associations.
|
boolean |
isEmpty()
Test whether this
HMap is empty. |
Iterator<Tuple2<TypeSafeKey<?,?>,Object>> |
iterator() |
Set<TypeSafeKey<?,?>> |
keys()
Retrieve all the mapped keys.
|
<V> HMap |
put(TypeSafeKey<?,V> key,
V value)
Store a value for the given key.
|
HMap |
putAll(HMap hMap)
Store all the key/value mappings in
hMap in this HMap. |
HMap |
remove(TypeSafeKey<?,?> key)
Remove a mapping from this HMap.
|
HMap |
removeAll(HMap hMap)
Remove all the key/value mappings in
hMap from this HMap. |
static <V> HMap |
singletonHMap(TypeSafeKey<?,V> key,
V value)
Static factory method for creating a singleton HMap.
|
Map<TypeSafeKey<?,?>,Object> |
toMap()
|
String |
toString() |
Collection<Object> |
values()
Retrieve all the mapped values.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic <A,B> Maybe<B> get(TypeSafeKey<A,B> key)
A - the value typeB - the value typekey - the keypublic <V> V demand(TypeSafeKey<?,V> key) throws NoSuchElementException
NoSuchElementException if this key is unmapped.V - the value typekey - the keyNoSuchElementException - if the key is unmappedpublic <V> HMap put(TypeSafeKey<?,V> key, V value)
V - the value typekey - the keyvalue - the valuepublic HMap putAll(HMap hMap)
hMap in this HMap.hMap - the other HMappublic boolean containsKey(TypeSafeKey<?,?> key)
key - the keypublic HMap remove(TypeSafeKey<?,?> key)
key - the keypublic HMap removeAll(HMap hMap)
hMap from this HMap.hMap - the other HMappublic boolean isEmpty()
HMap is empty.HMap is empty; false otherwise.public Set<TypeSafeKey<?,?>> keys()
Note that unlike with Map.keySet(), the resulting key set is not "live"; in fact
that is, alterations to the resulting key set have no effect on the backing HMap.
Set of all the mapped keyspublic Collection<Object> values()
List of all the mapped valuespublic Map<TypeSafeKey<?,?>,Object> toMap()
Map view of the current snapshot of this HMap. Note that updates to either the
Map view or to the original HMap do not propagate to the other.public Iterator<Tuple2<TypeSafeKey<?,?>,Object>> iterator()
iterator in interface Iterable<Tuple2<TypeSafeKey<?,?>,Object>>public static HMap emptyHMap()
public static <V> HMap singletonHMap(TypeSafeKey<?,V> key, V value)
V - the only mapped value typekey - the only mapped keyvalue - the only mapped valuepublic static <V1,V2> HMap hMap(TypeSafeKey<?,V1> key1, V1 value1, TypeSafeKey<?,V2> key2, V2 value2)
V1 - value1's typeV2 - value2's typekey1 - the first mapped keyvalue1 - the value mapped at key1key2 - the second mapped keyvalue2 - the value mapped at key2public static <V1,V2,V3> HMap hMap(TypeSafeKey<?,V1> key1, V1 value1, TypeSafeKey<?,V2> key2, V2 value2, TypeSafeKey<?,V3> key3, V3 value3)
V1 - value1's typeV2 - value2's typeV3 - value3's typekey1 - the first mapped keyvalue1 - the value mapped at key1key2 - the second mapped keyvalue2 - the value mapped at key2key3 - the third mapped keyvalue3 - the value mapped at key3public static <V1,V2,V3,V4> HMap hMap(TypeSafeKey<?,V1> key1, V1 value1, TypeSafeKey<?,V2> key2, V2 value2, TypeSafeKey<?,V3> key3, V3 value3, TypeSafeKey<?,V4> key4, V4 value4)
V1 - value1's typeV2 - value2's typeV3 - value3's typeV4 - value4's typekey1 - the first mapped keyvalue1 - the value mapped at key1key2 - the second mapped keyvalue2 - the value mapped at key2key3 - the third mapped keyvalue3 - the value mapped at key3key4 - the fourth mapped keyvalue4 - the value mapped at key4public static <V1,V2,V3,V4,V5> HMap hMap(TypeSafeKey<?,V1> key1, V1 value1, TypeSafeKey<?,V2> key2, V2 value2, TypeSafeKey<?,V3> key3, V3 value3, TypeSafeKey<?,V4> key4, V4 value4, TypeSafeKey<?,V5> key5, V5 value5)
V1 - value1's typeV2 - value2's typeV3 - value3's typeV4 - value4's typeV5 - value5's typekey1 - the first mapped keyvalue1 - the value mapped at key1key2 - the second mapped keyvalue2 - the value mapped at key2key3 - the third mapped keyvalue3 - the value mapped at key3key4 - the fourth mapped keyvalue4 - the value mapped at key4key5 - the fifth mapped keyvalue5 - the value mapped at key5public static <V1,V2,V3,V4,V5,V6> HMap hMap(TypeSafeKey<?,V1> key1, V1 value1, TypeSafeKey<?,V2> key2, V2 value2, TypeSafeKey<?,V3> key3, V3 value3, TypeSafeKey<?,V4> key4, V4 value4, TypeSafeKey<?,V5> key5, V5 value5, TypeSafeKey<?,V6> key6, V6 value6)
V1 - value1's typeV2 - value2's typeV3 - value3's typeV4 - value4's typeV5 - value5's typeV6 - value6's typekey1 - the first mapped keyvalue1 - the value mapped at key1key2 - the second mapped keyvalue2 - the value mapped at key2key3 - the third mapped keyvalue3 - the value mapped at key3key4 - the fourth mapped keyvalue4 - the value mapped at key4key5 - the fifth mapped keyvalue5 - the value mapped at key5key6 - the sixth mapped keyvalue6 - the value mapped at key6public static <V1,V2,V3,V4,V5,V6,V7> HMap hMap(TypeSafeKey<?,V1> key1, V1 value1, TypeSafeKey<?,V2> key2, V2 value2, TypeSafeKey<?,V3> key3, V3 value3, TypeSafeKey<?,V4> key4, V4 value4, TypeSafeKey<?,V5> key5, V5 value5, TypeSafeKey<?,V6> key6, V6 value6, TypeSafeKey<?,V7> key7, V7 value7)
V1 - value1's typeV2 - value2's typeV3 - value3's typeV4 - value4's typeV5 - value5's typeV6 - value6's typeV7 - value7's typekey1 - the first mapped keyvalue1 - the value mapped at key1key2 - the second mapped keyvalue2 - the value mapped at key2key3 - the third mapped keyvalue3 - the value mapped at key3key4 - the fourth mapped keyvalue4 - the value mapped at key4key5 - the fifth mapped keyvalue5 - the value mapped at key5key6 - the sixth mapped keyvalue6 - the value mapped at key6key7 - the seventh mapped keyvalue7 - the value mapped at key7public static <V1,V2,V3,V4,V5,V6,V7,V8> HMap hMap(TypeSafeKey<?,V1> key1, V1 value1, TypeSafeKey<?,V2> key2, V2 value2, TypeSafeKey<?,V3> key3, V3 value3, TypeSafeKey<?,V4> key4, V4 value4, TypeSafeKey<?,V5> key5, V5 value5, TypeSafeKey<?,V6> key6, V6 value6, TypeSafeKey<?,V7> key7, V7 value7, TypeSafeKey<?,V8> key8, V8 value8)
V1 - value1's typeV2 - value2's typeV3 - value3's typeV4 - value4's typeV5 - value5's typeV6 - value6's typeV7 - value7's typeV8 - value8's typekey1 - the first mapped keyvalue1 - the value mapped at key1key2 - the second mapped keyvalue2 - the value mapped at key2key3 - the third mapped keyvalue3 - the value mapped at key3key4 - the fourth mapped keyvalue4 - the value mapped at key4key5 - the fifth mapped keyvalue5 - the value mapped at key5key6 - the sixth mapped keyvalue6 - the value mapped at key6key7 - the seventh mapped keyvalue7 - the value mapped at key7key8 - the eighth mapped keyvalue8 - the value mapped at key8