public class MapUtil extends Object
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
getFlattenedMap(Map<?,?> source)
Build a flattened representation of provided Map.
|
static void |
mergeIfAbsent(Map<String,String> map,
Map<String,String> toMerge)
Add all values of a map to another map, but only 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.
|
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)
K
- first typeV
- second typemap1
- first hash mapmap2
- second hash mappublic static void putAllIfNotNull(Map<String,String> ret, Map<String,String> toPut)
ret
- target hash maptoPut
- source hash mapCopyright © 2021. All rights reserved.