CopyOnWriteArrayList in Java

CopyOnWriteArrayList in Java implements the List interface just like its other well known counterpart ArrayList and is part of java.util.concurrent package. How CopyOnWriteArrayList differs from ArrayList is that it is a thread-safe variant of ArrayList. For more differences between CopyOnWriteArrayList and ArrayList in Java refer this post- Difference Between ArrayList…

Continue reading

ConcurrentHashMap in Java

ConcurrentHashMap in Java is a thread safe Map implementation which provides another alternative to be used in a multithreaded environment apart from HashTable or explicitly synchronizing HashMap. ConcurrentHashMap is part of the java.util.concurrent package. How is ConcurrentHashMap a better option Other thread safe implementations like HashTable or explicit synchronization of…

Continue reading