Given a Set with elements (10,20,30,40,...) we need to find the next smallest and next largest element (both inclusive), e.g. nextSmallest(25) = 20, nextLargest(25) = 30.
Given a TreeMap this can be quickly done by traversing the tree. Sadly to achieve this in Scala 2.11 you have to copy the code of the TreeMap and RedBlack-classes.
On the other hand the next largest element can now be efficiently found using iteratorFrom introduced by #6642.
There should be a simple way to find the next smallest element, for example by introducing a reverseIteratorFrom.
Given a Set with elements
(10,20,30,40,...)
we need to find the next smallest and next largest element (both inclusive), e.g.nextSmallest(25) = 20, nextLargest(25) = 30
.Given a TreeMap this can be quickly done by traversing the tree. Sadly to achieve this in Scala 2.11 you have to copy the code of the TreeMap and RedBlack-classes.
On the other hand the next largest element can now be efficiently found using iteratorFrom introduced by #6642.
There should be a simple way to find the next smallest element, for example by introducing a
reverseIteratorFrom
.