@@ -0,0 +1,988 @@
+package concurrency.concurrentcollection;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.concurrent.ConcurrentHashMap;%0A%0A/**%0A * Below 2 classes have thread safety%0A *%0A * - SynchronizedMapData%0A * used synchronized methods to access its map data%0A *%0A * - ConcurrentMapData%0A * uses built-in ConcurrentHashMap which does same as synchronized access methods%0A *%0A */%0A%0Aclass SynchronizedMapData %7B%0A    private Map%3CString, String%3E data = new HashMap%3C%3E();%0A%0A    public synchronized void put(String key, String value) %7B%0A        data.put(key, value);%0A    %7D%0A    public synchronized String get(String key) %7B%0A        return data.get(key);%0A    %7D%0A%7D%0A%0Aclass ConcurrentMapData %7B%0A    private Map%3CString, String%3E data = new ConcurrentHashMap%3C%3E();%0A    public void put(String key, String value) %7B%0A        data.put(key, value);%0A    %7D%0A    public String get(String key) %7B%0A        return data.get(key);%0A    %7D%0A%7D%0A%0Apublic class ConcurrentMapExample %7B%0A    public static void main(String%5B%5D args) %7B%0A%0A    %7D%0A%7D%0A

Create ConcurrentMapExample.java