Here you can find the source of merge(Map
public static <K, V> Map<K, V> merge(Map<K, V> into, Map<K, V> with)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <K, V> Map<K, V> merge(Map<K, V> into, Map<K, V> with) { Map<K, V> result = new LinkedHashMap<>(into.size() + with.size()); result.putAll(into);//from w w w .ja v a 2 s . c o m result.putAll(with); return result; } }