Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 我应该什么时候使用 ConcurrentSkipListMap?
我的意思是,如果 Java 库中有 ConcurrentSkipListMap,它有时可能比 ConcurrentHashMap 更好。我想知道 ConcurrentSkipListMap 哪里真的好?
ConcurrentSkipListMap 支持 SortedMap 和 NavigableMap。如果您需要对数据进行排序,这是可以使用的(如果您不需要并发,则使用 TreeMap)
你也可以用 Collections.setFromMap() 包装它来创建一个并发的 SortedSet。