Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iteratorFrom SplayTreeMap #10158

Open
jtmcdole opened this issue Apr 23, 2013 · 3 comments
Open

Add iteratorFrom SplayTreeMap #10158

jtmcdole opened this issue Apr 23, 2013 · 3 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-n P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@jtmcdole
Copy link
Contributor

It would be nice to have an iterator (forward and reverse varieties) starting from a given key. Currently if you want to walk the tree from a given point, its a series of map lookups.

@lrhn
Copy link
Member

lrhn commented Apr 24, 2013

Removed Type-Defect label.
Added Type-Enhancement, Area-Library, Triaged labels.

@lrhn
Copy link
Member

lrhn commented Apr 24, 2013

Splay trees are not really built for iteration. If you even read from the tree while iterating, it changes its structure. However, it isn't suitable to throw a ConcurrentModificationError due to a reading operation, so we'll have to handle it behind the scenes (somewhat inefficiently).

Iteration would be easier if we added a parent link, but that would be an overhead when it's not used.

It would probably be better to have a stable tree structure (AVL or Red/Black trees) as well. They have a slightly higher overhead, but better guarantees/worst case behavior. For those, an "iterateFrom/bidi-iterator" would make more sense.

@jtmcdole
Copy link
Contributor Author

Ah, I didn't notice the missing parent link. I can just pull over an AVL implementation from java.

@jtmcdole jtmcdole added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Apr 24, 2013
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed triaged labels Feb 29, 2016
@lrhn lrhn added the core-m label Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-n P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants