collection icon indicating copy to clipboard operation
collection copied to clipboard

Add efficient range methods to SplayTreeMap

Open renatoathaydes opened this issue 5 years ago • 2 comments

SplayTreeMap is very useful for managing time series and other sorted data. A common use case involves looking at a range (imagine zooming into a small area of a large chart) efficiently, but the current implementation does not offer methods to do that.

The existing lastKeyBefore and firstKeyAfter methods are not very useful if it's not possible to use them to do tree.subtree(firstKeyAfter(x), lastKeyBefore(y)).

Can we please add such a range method to SplayTreeMap?

Examples in other languages:

renatoathaydes avatar Aug 22 '19 17:08 renatoathaydes

cc @lrhn

natebosch avatar Aug 22 '19 17:08 natebosch

I have pushed a proposal: https://dart-review.googlesource.com/c/sdk/+/144765

jpnurmi avatar Apr 25 '20 09:04 jpnurmi