[英]Java Concurrent HashMap
我想將ConcurrentHashMap轉換為TreeMap。我能這樣做嗎?
如果需要Sorted ConcurrentMap,請查看ConcurrentSkipListMap 。 考慮到它的復雜性,它既無阻塞又快速。 更加具體:
time cost for the 此類實現了SkipLists的並發變體,提供了預期的平均時間成本
containsKey,get,put和remove操作及其變體。
ConcurrentHashMap
仍然是Map
。 所以你可以像這樣創建一個新的TreeMap
:
ConcurrentHashMap myMap;
...
TreeMap myTreeMap = new TreeMap( myMap );
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.