Here you can find the source of mergeMaps(Map
private static <K, V> Map<K, V> mergeMaps(Map<K, V> m1, Map<K, V> m2)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; public class Main { private static <K, V> Map<K, V> mergeMaps(Map<K, V> m1, Map<K, V> m2) { Map<K, V> m = new HashMap<>(); if (m1 != null) m.putAll(m1);//from ww w . j av a2 s . co m if (m2 != null) m.putAll(m2); return m; } }