Here you can find the source of merge(final Map
public static <K, V> Map<K, V> merge(final Map<K, V> map1, final Map<K, V> map2)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; public class Main { public static <K, V> Map<K, V> merge(final Map<K, V> map1, final Map<K, V> map2) { final HashMap<K, V> ret = new HashMap<K, V>(map1); ret.putAll(map2);/*from w ww . ja va 2 s . c om*/ return ret; } }