Package dev.voidframework.core.lang
Class TypedMap
java.lang.Object
dev.voidframework.core.lang.TypedMap
Typed key-value map.
- Since:
- 1.0.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean<T> Tget(TypedMap.Key<T> typedKey) Retrieves the value associated to the specified key.inthashCode()static <K,V extends K>
TypedMapof(TypedMap.Key<K> key, V value) Returns a typed map.static <K1,V1 extends K1, K2, V2 extends K2>
TypedMapof(TypedMap.Key<K1> key1, V1 value1, TypedMap.Key<K2> key2, V2 value2) Returns a typed map.static <K1,V1 extends K1, K2, V2 extends K2, K3, V3 extends K3>
TypedMapof(TypedMap.Key<K1> key1, V1 value1, TypedMap.Key<K2> key2, V2 value2, TypedMap.Key<K3> key3, V3 value3) Returns a typed map.static <K1,V1 extends K1, K2, V2 extends K2, K3, V3 extends K3, K4, V4 extends K4>
TypedMapof(TypedMap.Key<K1> key1, V1 value1, TypedMap.Key<K2> key2, V2 value2, TypedMap.Key<K3> key3, V3 value3, TypedMap.Key<K4> key4, V4 value4) Returns a typed map.<T> Tput(TypedMap.Key<T> typedKey, T value) Associates the specified value with the specified key.<T> Tremove(TypedMap.Key<T> typedKey) Removes the value associated to the specified key.toString()
-
Constructor Details
-
TypedMap
public TypedMap()Build a new instance.- Since:
- 1.0.0
-
-
Method Details
-
of
Returns a typed map.- Type Parameters:
K- The type of the Key objectV- The type of the Value object- Parameters:
key- The mapping keyvalue- The mapping value- Returns:
- A typed map containing the specified mapping
-
of
public static <K1,V1 extends K1, TypedMap ofK2, V2 extends K2> (TypedMap.Key<K1> key1, V1 value1, TypedMap.Key<K2> key2, V2 value2) Returns a typed map.- Type Parameters:
K1- The type of the first Key objectV1- The type of the first Value objectK2- The type of the second Key objectV2- The type of the second Value object- Parameters:
key1- The first mapping keyvalue1- The first mapping valuekey2- The second mapping keyvalue2- The second mapping value- Returns:
- A typed map containing the specified mapping
-
of
public static <K1,V1 extends K1, TypedMap ofK2, V2 extends K2, K3, V3 extends K3> (TypedMap.Key<K1> key1, V1 value1, TypedMap.Key<K2> key2, V2 value2, TypedMap.Key<K3> key3, V3 value3) Returns a typed map.- Type Parameters:
K1- The type of the first Key objectV1- The type of the first Value objectK2- The type of the second Key objectV2- The type of the second Value objectK3- The type of the third Key objectV3- The type of the third Value object- Parameters:
key1- The first mapping keyvalue1- The first mapping valuekey2- The second mapping keyvalue2- The second mapping valuekey3- The third mapping keyvalue3- The third mapping value- Returns:
- A typed map containing the specified mapping
-
of
public static <K1,V1 extends K1, TypedMap ofK2, V2 extends K2, K3, V3 extends K3, K4, V4 extends K4> (TypedMap.Key<K1> key1, V1 value1, TypedMap.Key<K2> key2, V2 value2, TypedMap.Key<K3> key3, V3 value3, TypedMap.Key<K4> key4, V4 value4) Returns a typed map.- Type Parameters:
K1- The type of the first Key objectV1- The type of the first Value objectK2- The type of the second Key objectV2- The type of the second Value objectK3- The type of the third Key objectV3- The type of the third Value objectK4- The type of the fourth Key objectV4- The type of the fourth Value object- Parameters:
key1- The first mapping keyvalue1- The first mapping valuekey2- The second mapping keyvalue2- The second mapping valuekey3- The third mapping keyvalue3- The third mapping valuekey4- The fourth mapping keyvalue4- The fourth mapping value- Returns:
- A typed map containing the specified mapping
-
get
Retrieves the value associated to the specified key.- Type Parameters:
T- The value type- Parameters:
typedKey- The typed key- Returns:
- The value associated to the specified key, otherwise,
null - Since:
- 1.0.0
-
put
Associates the specified value with the specified key.- Type Parameters:
T- The value type- Parameters:
typedKey- The typed keyvalue- The value to associate with the given key- Returns:
- The previous value associated with key, otherwise,
null - Since:
- 1.0.0
-
remove
Removes the value associated to the specified key.- Type Parameters:
T- The value type- Parameters:
typedKey- The typed key- Returns:
- The value associated to the specified key, otherwise,
null - Since:
- 1.0.0
-
equals
-
hashCode
public int hashCode() -
toString
-