简体   繁体   English

如何获取ConcurrentHashMap的tailMap?

[英]How to get tailMap for ConcurrentHashMap?

I am using TreeMap to get tailMap , but its causing concurrency issues. 我正在使用TreeMap获取tailMap ,但其导致并发问题。 So I decided to use ConcurrentHashMap instead. 因此,我决定改用ConcurrentHashMap How do I get tailMap for ConcurrentHashMap ? 如何获得ConcurrentHashMap tailMap

There isn't any API like map.tailMap(key) for ConcurrentHashMap . 没有像ConcurrentHashMap这样的API,例如map.tailMap(key)

Thanks 谢谢

That method is defined in the interface SortedMap , so you need to use a map that implements that interface. 该方法在SortedMap接口中定义,因此您需要使用实现该接口的映射。 The likely concurrent candidate is ConcurrentSkipListMap . 可能的并发候选对象是ConcurrentSkipListMap

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM