Here you can find the source of replaceElements(Map
public static <K, V> void replaceElements(Map<K, V> destinationMap, Map<K, V> sourceMap)
//package com.java2s; //License from project: Apache License import java.util.Map; public class Main { public static <K, V> void replaceElements(Map<K, V> destinationMap, Map<K, V> sourceMap) { if (destinationMap != null && sourceMap != null) { destinationMap.clear();/*w w w . j av a 2s.c o m*/ destinationMap.putAll(sourceMap); } } }