Key
- The key typeValue
- The value typepublic class MapBuilder<Key,Value> extends Object
Constructor and Description |
---|
MapBuilder() |
MapBuilder(Map<Key,Value> map)
Create a new map builder with the provided map as input
|
Modifier and Type | Method and Description |
---|---|
Map<Key,Value> |
build()
Return a new map which is separated from this map builder
|
MapBuilder<Key,Value> |
clear()
Clean the map held by the map builder
|
Map<Key,Value> |
getMap()
Get the map of the map builder.
|
MapBuilder<Key,Value> |
put(Key key,
Value value)
Put a pair into the map held by the map builder
|
MapBuilder<Key,Value> |
putAll(Map<Key,Value> values)
Add all entries from the provided map
|
static <Key,Value> |
toMap(Map<Key,Value> map,
Pair<Key,Value> pair)
Return a new map containing the provided pair, or add the pair to an
already existing map.
|
static <Key,Value> |
toMap(Pair<Key,Value> pair)
Return a new map the containing only the provided value pair
|
public MapBuilder(Map<Key,Value> map)
map
- the content that should be used as initial content. The
provided map will not be modified.public MapBuilder()
public final MapBuilder<Key,Value> put(Key key, Value value)
key
- The keyvalue
- The valuepublic final MapBuilder<Key,Value> putAll(Map<Key,Value> values)
values
- the values to addpublic final MapBuilder<Key,Value> clear()
public final Map<Key,Value> getMap()
Note that no copy is returned of the map. So further modifications using the this MapBuilder instance will change the returned map.
public Map<Key,Value> build()
public static <Key,Value> Map<Key,Value> toMap(Pair<Key,Value> pair)
Key
- The key typeValue
- The value typepair
- The pair to addpublic static <Key,Value> Map<Key,Value> toMap(Map<Key,Value> map, Pair<Key,Value> pair)
Key
- The key typeValue
- The value typemap
- The map to which the pair should be added (may be
null
)pair
- The pair to add (may not be null
)Copyright © 2016 Eclipse NeoSCADA Project. All rights reserved.