// "Replace iteration with bulk 'Map.putAll()' call" "true-preview" import java.util.*; class Main { void test(Map map) { Map result = new HashMap<>(); result.put("answer", 42); Iterator> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry e = iterator.next(); result.put(e.getKey(), e.getValue()); } } }