Class MapBuilder<K,V>
java.lang.Object
com.google.cloud.spring.core.util.MapBuilder<K,V>
- Type Parameters:
K
- map key typeV
- map value type
Utility for building an immutable, type-safe
Map
.
Underlying implementation uses a HashMap
, but disallows null
keys,
null
values, and duplicate keys. This is consistent with Java 9 Map.of()
static factory
method, which will eventually replace the uses of this utility.
- Since:
- 1.1
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
MapBuilder
public MapBuilder()
-
-
Method Details
-
put
Adds a unique non-null key/value pair.- Parameters:
key
- non-null keyvalue
- non-null value- Returns:
- itself for chaining
-
build
-
buildModifiable
-