vavr
vavr copied to clipboard
Add navigation methods to SortedSet
I suggest to add navigational methods to javaslang.collection.SortedSet.
These are the methods that should be added to this interface:
descendingIterator()descendingSet()subSet()headSet()tailSet()floor()ceiling()higher()lower()
These are the same navigation methods recently added to javaslang.collection.SortedMap.
Most of the work to support these methods has already been implemented in RedBlackTree, so it should be a relatively task.
@danieldietrich I can do this :). But I don't see the methods declared in javaslang.collection.SortedMap
Hi @ashrko619,
please hold your horses :) We are already in the middle of something. For SortedSet the methods are on the way, for SortedMap it will be (hopefully) straightforward when SortedSet is finished.
@eduardmanas has already implemented it for SortedSet, see PR #1317.
It is a very big PR with many changes to the internal core collection RedBlackTree, which is the base for sorted sets and maps. I've done some changes in a local branch but am still not finished.
Because we need a view on a RedBlackTree for the descending case, we need to simplify the type hierarchy of RedBlackTree. We will use null as internal representation for empty. But the public API still need an empty RedBlackTree. We can do this independent of this issue, so I created #1581.
@eduardmanas Sorry for keeping the PR open for so long!
Sure @danieldietrich, unfortunately I have been very busy at work, so I haven't been able to help much in the last few months. But I promise to find the time once you complete your RedBlackTree review! :)
@ashrko619, the RedBlackTree implementation in #1317 is currently only used by SortedMap. This is however a complex implementation, as we need to use views (similar to the java.util.TreeMap implementation of navigational methods). Once we are happy with the implementation, adding navigational support for SortedSet will be trivial. Feel free to review that PR!