Here you can find the source of copy(Map
public static <K, V> Map<K, V> copy(Map<K, V> map)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <K, V> Map<K, V> copy(Map<K, V> map) { Map<K, V> copy = new HashMap<>(); for (K key : map.keySet()) { copy.put(key, map.get(key)); }//from www. j ava 2s. c o m return copy; } }