Java tutorial
import java.util.HashMap; public class Main { public static void main(String args[]) { HashMap<Integer, String> newmap2 = new HashMap<Integer, String>(); HashMap<Integer, String> newmap1 = new HashMap<Integer, String>(); // populate hash map newmap1.put(1, "tutorials"); newmap1.put(2, "from"); newmap1.put(3, "java2s.com"); System.out.println("Values in newmap1: " + newmap1); // put all values in newmap2 newmap2.putAll(newmap1); System.out.println("Values in newmap2: " + newmap2); } }