After introduction of concurrency api in Java 1.5 we have one more way to synchronize a hashmap>> new java.util.concurrent.ConcurrentHashMap(hashmapObj);
We can do as given belowHashMap hm = new HashMap();
HashMap hm2 = (HashMap)Collections.synchronizedMap(hm);
ArrayList a1 = new ArrayList();
ArrayList a2 = (ArrayList)Collections.synchronizedList(...