ConcurrentSkipListMap in Java

This post talks about the ConcurrentSkipListMap class from the java.util.concurrent package and the interface ConcurrentNavigableMap this class implements. ConcurrentSkipListMap in Java ConcurrentSkipListMap is a thread-safe, scalable Map that stores its elements in sorted manner. By default map is sorted according to the natural ordering of its keys, or by a…

Continue reading

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 better option Other thread safe implementations like HashTable or explicit synchronization of HashMap…

Continue reading