Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <K, V> Map<K, V> clone(Map<K, V> map1) { Map<K, V> map2 = new HashMap<K, V>(map1.size()); for (Map.Entry<K, V> e : map1.entrySet()) { map2.put(e.getKey(), e.getValue()); } return map2; } }