Java Map Put putAll(Map map, Map otherMap)

Here you can find the source of putAll(Map map, Map otherMap)

Description

Map.putall with non null check on the other map.

License

Apache License

Parameter

Parameter Description
map The map in which to put data.
otherMap The map to merge in the first map (may be null).
K Type of keys.
V Type of values.

Declaration

public static <K, V> void putAll(Map<K, V> map, Map<K, V> otherMap) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Map;

public class Main {
    /**//from w  ww  .j  ava2s  . c om
     * Map.putall with non null check on the other map.
     * 
     * @param map The map in which to put data.
     * @param otherMap The map to merge in the first map (may be null).
     * @param <K> Type of keys.
     * @param <V> Type of values.
     */
    public static <K, V> void putAll(Map<K, V> map, Map<K, V> otherMap) {
        if (otherMap != null) {
            map.putAll(otherMap);
        }
    }
}

Related

  1. putAbsent(Map dest, Map src)
  2. putAll(final Map dst, final Map src)
  3. putAll(M map, Iterable> values)
  4. putAll(Map original, Map... others)
  5. putAll(Map dest, Collection src, V value)
  6. putAll(Map map, Object... keysAndValues)
  7. putAll(Map model, String prefix, Map subModel)
  8. putAll(Map map, String prefix, Map values)
  9. putAllIfAbsent(final Map target, final Map source)