Java tutorial
import java.util.HashMap; public class Main { public static void main(String args[]) { // create two hash maps HashMap<Integer, String> newmap1 = new HashMap<Integer, String>(); HashMap<Integer, String> newmap2 = new HashMap<Integer, String>(); // populate hash map newmap1.put(1, "tutorials"); newmap1.put(2, "from"); newmap1.put(3, "java2s.com"); // clone 1st map newmap2 = (HashMap) newmap1.clone(); System.out.println("1st Map: " + newmap1); System.out.println("Cloned 2nd Map: " + newmap2); } }