Java Utililty Methods Map Merge

List of utility methods to do Map Merge

Description

The list of methods to do Map Merge are organized into topic(s).

Method

Mapmerge(Map into, Map with)
merge
Map<K, V> result = new LinkedHashMap<>(into.size() + with.size());
result.putAll(into);
result.putAll(with);
return result;
Mapmerge(Map left, Map right)
Merge map.
Map<K, V> resultMap = new HashMap<K, V>();
resultMap.putAll(left);
resultMap.putAll(right);
return resultMap;
Mapmerge(Map map, K key, V value)
merge
map.put(key, value);
return map;
Mapmerge(Map map, Map... maps)
merge
if (maps != null && maps.length > 0) {
    for (Map<K, V> m : maps)
        map.putAll(m);
return map;
voidmerge(Map master, Map copy)
merge
copy.putAll(master);
Mapmerge(Map src, Map dest)
merge
if (src == null || src.size() == 0) {
    return dest;
if (dest == null || dest.size() == 0) {
    return src;
Map<String, Object> result = new HashMap<>();
src.forEach((key, value) -> {
...
Mapmerge(Map first, Map second)
merge
if (second == null || second.isEmpty())
    return first;
if (first == null || first.isEmpty())
    return second;
Map<String, Object> combined = new HashMap<>(first);
combined.putAll(second);
return combined;
Mapmerge(Map map1, Map map2)
merge
Map<T1, T3> map3 = new HashMap<T1, T3>(map1.size());
merge(map1, map2, map3);
return map3;
Mapmerge(Map mapPriorityLeast, Map mapPriorityFirst)
merge
Map<T1, T2> newMap = new HashMap<>();
for (Map.Entry<T1, T2> entry : mapPriorityLeast.entrySet()) {
    newMap.put(entry.getKey(), entry.getValue());
for (Map.Entry<T1, T2> entry : mapPriorityFirst.entrySet()) {
    newMap.put(entry.getKey(), entry.getValue());
return newMap;
...
MapmergeAggCompStatsTopoPageSpout(Map accSpoutStats, Map spoutStats)
merge accumulated bolt stats with new bolt stats
Map<String, Object> ret = new HashMap<>();
Integer numExecutors = getByKeyOr0(accSpoutStats, NUM_EXECUTORS).intValue();
putKV(ret, NUM_EXECUTORS, numExecutors + 1);
putKV(ret, NUM_TASKS, sumOr0(getByKeyOr0(accSpoutStats, NUM_TASKS), getByKeyOr0(spoutStats, NUM_TASKS)));
putKV(ret, EMITTED, sumOr0(getByKeyOr0(accSpoutStats, EMITTED), getByKeyOr0(spoutStats, EMITTED)));
putKV(ret, TRANSFERRED,
        sumOr0(getByKeyOr0(accSpoutStats, TRANSFERRED), getByKeyOr0(spoutStats, TRANSFERRED)));
putKV(ret, COMP_LAT_TOTAL,
...