ConcurrentHashMapmap = new ConcurrentHashMap<>(); map.put("one", 1); map.put("two", 2); map.put("three", 3); Integer value = map.get("two"); System.out.println("Value for key 'two': " + value);
Value for key 'two': 2
ConcurrentHashMapmap = new ConcurrentHashMap<>(); map.put(1, "John"); map.put(2, "Alex"); map.put(3, "Bob"); String value = map.get(3); System.out.println("Value for key 3: " + value);
Value for key 3: BobThe package library of ConcurrentHashMap is java.util.concurrent.