public class MapUtil extends Object
Modifier and Type | Method and Description |
---|---|
static void |
mergeIfAbsent(Map<String,String> map,
Map<String,String> toMerge)
Add all values of a map to another map, but onlfy if not already existing.
|
static <K,V> Map<K,V> |
mergeMaps(Map<K,V> map1,
Map<K,V> map2)
Returns a new map with all the entries of map1 and any from map2 which don't override map1.
|
static void |
putIfAbsent(Map<String,String> map,
String name,
String value)
Adds the given key and value pair into the map if the map does not already contain a value for that key
|
public static void putIfAbsent(Map<String,String> map, String name, String value)
public static void mergeIfAbsent(Map<String,String> map, Map<String,String> toMerge)
map
- target maptoMerge
- the values to adCopyright © 2017. All rights reserved.