0

I am using TreeMap to get tailMap, but its causing concurrency issues. So I decided to use ConcurrentHashMap instead. How do I get tailMap for ConcurrentHashMap?

There isn't any API like map.tailMap(key) for ConcurrentHashMap.

Thanks

Michał Schielmann
  • 1,372
  • 8
  • 17
Script_Junkie
  • 277
  • 2
  • 6
  • 17

1 Answers1

2

That method is defined in the interface SortedMap, so you need to use a map that implements that interface. The likely concurrent candidate is ConcurrentSkipListMap.

Don Roby
  • 40,677
  • 6
  • 91
  • 113