3

Possible Duplicate:
When should I use ConcurrentSkipListMap?

I mean if there is ConcurrentSkipListMap in java libs it might be sometimes better than ConcurrentHashMap. I wonder where ConcurrentSkipListMap really good?

Community
  • 1
  • 1
user293756
  • 169
  • 1
  • 7
  • 2
    Reading the javadoc it is clear that `ConcurrentSkipListMap` is also a `NavigableMap`. The interesting question is how does the concurrency behavior or performance compare to `ConcurrentHashMap`. – Nr9 Mar 24 '11 at 13:12

1 Answers1

10

ConcurrentSkipListMap supported SortedMap and NavigableMap. If you need data sorted, this is the one to use (Or TreeMap if you don't need concurrency)

You can also wrap it with Collections.setFromMap() to create a concurrent SortedSet.

Eugene
  • 117,005
  • 15
  • 201
  • 306
Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • that and another thing: ConcurrentSkipListMap is built for higher concurrency performance whereas a ConcurrentHashMap is geared towards great map-sizes performance. – kellogs Sep 20 '11 at 16:00
  • The CSLM has higher concurrency when you have an average of 16 cores or more using the map. You can configure CHM to support higher concurrency. ;) – Peter Lawrey Sep 20 '11 at 17:07