Package com.complexible.common.base
Class DataMap
java.lang.Object
com.complexible.common.base.DataMap
An object that maps keys to values in a type-safe manner. A key cannot be mapped to multiple values. Each key
specifies the Java Object allowed for the values of the key. Neither null keys nor null values are allowed.
- Since:
- 2.0
- Version:
- 2.0
- Author:
- Evren Sirin
-
Method Summary
Modifier and TypeMethodDescription<V> boolean<V> VReturns the value to which the specified key is mapped, ornullif this map contains no mapping for the key.static DataMapof()Create a new empty data map.static <V> DataMapCreate a new data map with the given single mapping.static <V1,V2> DataMap Create a new data map with the given two mapping.static <V1,V2, V3>
DataMapCreate a new data map with the given three mappings.<V> V<V> DataMapAssociates the specified value with the specified key in this map.
-
Method Details
-
of
Create a new empty data map. -
of
Create a new data map with the given single mapping. -
of
Create a new data map with the given two mapping. -
of
public static <V1,V2, DataMap ofV3> (DataKey<V1> key1, V1 value1, DataKey<V2> key2, V2 value2, DataKey<V3> key3, V3 value3) Create a new data map with the given three mappings. -
get
Returns the value to which the specified key is mapped, ornullif this map contains no mapping for the key.- Type Parameters:
V- Allowed types for the specified key- Parameters:
key- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or
nullif this map contains no mapping for the key
-
set
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced by the specified value.- Type Parameters:
V- allowed types for this key- Parameters:
key- the key to identify the data valuevalue- the new data value to associate with the key- Returns:
- this data map for method chaining
-
contains
-
remove
-