Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.*; class ConcurrentHashMapputAllExample1 { public static void main(String[] args) { ConcurrentHashMap
hashmap = new ConcurrentHashMap
(); // creating new hash map hashmap.put(100, "AAA"); hashmap.put(101, "BBB"); hashmap.put(102, "CCC"); hashmap.put(103, "DDD"); hashmap.put(104, "EEE"); System.out.println(" Mappings : "+ hashmap); ConcurrentHashMap
newhashmap = new ConcurrentHashMap
(); newhashmap.putAll(hashmap); System.out.println("New mappings : "+ newhashmap); } }
Output