In Java, ConcurrentHashMap
is there for better multithreading
solution. Then when should I use ConcurrentSkipListMap
? Is it a redundan
Then when should I use ConcurrentSkipListMap?
When you (a) need to keep keys sorted, and/or (b) need the first/last, head/tail, and submap features of a navigable map.
The ConcurrentHashMap class implements the ConcurrentMap interface, as does ConcurrentSkipListMap. But if you also want the behaviors of SortedMap and NavigableMap, use ConcurrentSkipListMap
ConcurrentHashMap
ConcurrentSkipListMap
Here is table guiding you through the major features of the various Map implementations bundled with Java 11. Click/tap to zoom.
Keep in mind that you can obtain other Map implementations, and similar such data structures, from other sources such as Google Guava.