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 |
putAllIfNotNull(Map<String,String> ret,
Map<String,String> toPut)
Copies all of the elements i.e., the mappings, from toPut map into ret, if toPut isn't null.
|
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 adpublic static <K,V> Map<K,V> mergeMaps(Map<K,V> map1, Map<K,V> map2)
Copyright © 2020. All rights reserved.