Merge the values in the specified map with the values in this map and return the results in a new map.
@param multiMap The map to merge
@return A new map containing the merged values
764053
public MultiMap merge(MultiMap multiMap)
    {
        MultiMap result = new MultiMap();
        result.map.putAll(this.map);
        result.map.putAll(multiMap.map);
        return result;
    }
174399
private static void merge(Object m1) {
        if (m1 instanceof Map) {
            Iterator<Object> fieldNames = ((Map<Object, Object>) m1).keySet().iterator();
            String fieldName = null;
            while (fieldNames.hasNext()) {
                fieldName = String.valueOf(fieldNames.next());
                Object field1 = ((Map<String, Object>) m1).get(fieldName);
                if (field1 != null) {
                    if (field1 instanceof Map || field1 instanceof List) {
                        merge(field1);
                    // Overwrite previous value when the field1 can not be expanded further
                    } else if (field1 instanceof String) {
                        // Retrieve values from ConfigInjection.class
                        Object injectValue = ConfigInjection.getInjectValue((String) field1);
                        ((Map<String, Object>) m1).put(fieldName, injectValue);
                    }
                }
            }
        } else if (m1 instanceof List) {
            for (int i = 0; i < ((List<Object>) m1).size(); i++) {
                Object field1 = ((List<Object>) m1).get(i);
                if (field1 instanceof Map || field1 instanceof List) {
                    merge(field1);
                // Overwrite previous value when the field1 can not be expanded further
                } else if (field1 instanceof String) {
                    // Retrieve values from ConfigInjection.class
                    Object injectValue = ConfigInjection.getInjectValue((String) field1);
                    ((List<Object>) m1).set(i, injectValue);
                }
            }
        }
    }
104925
public static Object mergeObject(Object config, Class clazz) {
        merge(config);
        return convertMapToObj((Map<String, Object>) config, clazz);
    }
1351065
@SuppressWarnings("unchecked")
  private void mergeConfigs(Map<String, Map<String, ?>> configurationMap,
      Object parsed) {
    if(parsed instanceof Map) {
      Map<?, ?> parsedMap = (Map<?, ?>) parsed;
      for(Object key : parsedMap.keySet()) {
        if(key instanceof String) {
          Map<String, Object> existingValue = (Map<String, Object>) configurationMap.get((String) key);
          if(!configurationMap.containsKey((String) key)) {
            existingValue = new HashMap<String, Object>();
            configurationMap.put((String) key, existingValue);
          }
          Object parsedValue = parsedMap.get(key);
          if(parsedValue instanceof Map) {
            Map<?, ?> parsedValueMap = (Map<?, ?>) parsedValue;
            for(Object parsedKey : parsedValueMap.keySet()) {
              if(parsedKey instanceof String) {
                existingValue.put((String) parsedKey, parsedValueMap.get(parsedKey));
              }
            }
          }
        }
      }
    }
  }
306169
private void storeInMultiMap(MultiValueMap<String> map, String key, String[] values)
            throws JournalException {
        try {
            map.set(key, values);
        } catch (Exception e) {
            // totally bogus Exception here.
            throw new JournalException(e);
        }
    }
1059660
public static <K, V> KeyValueSink<K, V> asMapSink(ImmutableMultimap.Builder<K, V> multimapB) {
    return new ImmutableMultimapBuilderSink<>(multimapB);
  }
995953
public static <K, V, V2> MutableMap<K, V2> collectValues(
            Map<K, V> map,
            Function2<? super K, ? super V, ? extends V2> function)
    {
        return MapIterate.collectValues(map, function, UnifiedMap.<K, V2>newMap(map.size()));
    }
1208396
public static <K, V> Xmap<K, V> create(Map<K, V> map) {
        Xmap<K, V> xmap = new Xmap<>();
        xmap.putAll(map);
        return xmap;
    }
280722
public static <S, T> Map<S, T> merge(Map<S, T> map, Map<S, T> toMerge) {
        Map<S, T> ret = new HashMap<S, T>();
        ret.putAll(ensure(map));
        ret.putAll(ensure(toMerge));
        return ret;
    }
890277
public static <K, V> SetMultimap<K, V> newSetMultimap() {
        return new SetMultimap<K, V>(HashMap::new, HashSet::new, null);
    }
372462
static Map<String, Object> merge(List<Map<String, Object>> args) {
        if (args.size() > 1) {
            Map<String, Object> obj = args.get(0);
            for (int i = 1; i < args.size(); i++) {
                obj = mergeTwo(obj, args.get(i));
            }
            return obj;
        } else if (args.size() == 1) {
            return args.get(0);
        } else {
            return null;
        }
    }
326209
public static MultiValueMap asMultiValueMap(final Map innerMap) {
        return org.springframework.util.CollectionUtils.toMultiValueMap(innerMap);
    }
751992
public static <K extends Comparable<?>, V> ListMultimap<K, V> sortedArrayListMultimap()
    {
        Map<K, Collection<V>> map = Maps.newTreeMap();
        return Multimaps.newListMultimap(map, new Supplier<List<V>>() {
            @Override
            public List<V> get()
            {
                return Lists.newArrayList();
            }
        });
    }
360730
@SuppressWarnings("ConstantConditions")
  ImmutableSetMultimap<K,V> toImmutableSetMultimap() {
    final ImmutableSetMultimap.Builder<K, V>  ret = ImmutableSetMultimap.builder();

    for (final MultimapEntry<K, V> entry : entries) {
      ret.putAll(entry.key, entry.values);
    }

    return ret.build();
  }
445638
public static Map mapValues(Mapper mapper, Map map) {
        return mapValues(mapper, map, false);
    }
599455
public static <K, V> Map<K, V> wrap(final Multimap<K, V> source) {
        if (source != null && !source.isEmpty()) {
            val inner = source.asMap();
            val map = new HashMap<Object, Object>();
            inner.forEach((k, v) -> map.put(k, wrap(v)));
            return (Map) map;
        }
        return new HashMap<>(0);
    }
162529
public <A extends Appendable> A appendTo(A appendable, Multimap<?, ?> map) throws IOException {
		return appendTo(appendable, map.asMap().entrySet());
	}