HashMapIn the above example, we create two HashMaps, map1 and map2. We add some key-value pairs to map2. We then use the putAll() method to copy all the mappings from map2 to map1. Finally, we print map1 to verify that all the mappings have been copied successfully. This method belongs to the java.util package.map1 = new HashMap<>(); HashMap map2 = new HashMap<>(); map2.put("a", 1); map2.put("b", 2); map2.put("c", 3); map1.putAll(map2); System.out.println(map1);