I need to iterate both forwards and backwards in a sorted set. If I use NavigableSet, I get a strictly-forward iterator and a strictly-backward iterator (iterator()
and descendingIterator()
) but none that can move forward and backward.
What's the time complexity of NavigableSet.lower()
and higher()
? I can use those instead, but am reluctant to do so if they are inefficient.