List of utility methods to do Map Merge
Map | mergeMapIntoMap(Map merge Map Into Map if (destination == null) { return source; if (source == null) { return destination; source.keySet().stream().forEach(k -> { if (destination.containsKey(k)) { ... |
Map | mergeMapList(List merge Map List Map<K, V> ret = new HashMap<K, V>(); for (Map<K, V> listEntry : list) { if (listEntry == null) { continue; for (Entry<K, V> mapEntry : listEntry.entrySet()) { K key = mapEntry.getKey(); V value = mapEntry.getValue(); ... |
Map | mergeMaps(Map m1, Map m2) same as clojure's (merge-with merge m1 m2) if (m2 == null) { return m1; for (Object o : m2.entrySet()) { Map.Entry entry = (Map.Entry) o; Object k = entry.getKey(); Map existing = (Map) m1.get(k); if (existing == null) { ... |
Map | mergeMaps(Map mainMap, Map defaultMap, String[] keys, boolean enforceValues) merge Maps final String eLabel = "MapHelper.MergeMaps: "; HashMap returnMap = new HashMap(); if (defaultMap == null) { defaultMap = new HashMap(); try { for (int i = 0; i < keys.length; i++) { if (!mainMap.containsKey(keys[i]) && !defaultMap.containsKey(keys[i])) { ... |
void | mergeMaps(Map merge Maps for (Map.Entry<K, V> entry : inserts.entrySet()) { K key = entry.getKey(); V value = entry.getValue(); if (!dest.containsKey(key) || (dest.containsKey(key) && dest.get(key) != value)) { dest.put(key, value); |
void | mergeMaps(Map Merge maps. for (K key : from.keySet()) { if (override || !into.containsKey(key)) { into.put(key, from.get(key)); |
Map | mergeMaps(Map merge Maps Map<K, V> m = new HashMap<>(); if (m1 != null) m.putAll(m1); if (m2 != null) m.putAll(m2); return m; |
Map | mergeMaps(Map Returns a new map with all the entries of map1 and any from map2 which don't override map1. Map<K, V> answer = new HashMap<>(); if (map2 != null) { answer.putAll(map2); if (map1 != null) { answer.putAll(map1); return answer; ... |
Map | mergeMaps(Map Recursively merges a custom map into a default map, and returns the merged result. for (String key : defaultMap.keySet()) { if (!customMap.containsKey(key)) { continue; Object newValue; if (defaultMap.get(key) instanceof Map && !key.endsWith("Map")) { newValue = mergeMaps((Map<String, Object>) defaultMap.get(key), (Map<String, Object>) customMap.get(key)); ... |
void | mergeMaps(Map Merges the source map into the destination. assert (destination != null) : "You must provide a destination map to merge into."; if (source == null) return; for (String key : source.keySet()) { if (destination.get(key) != null) { } else { destination.put(key, source.get(key)); |