Open jtmcdole opened 11 years ago
Removed Type-Defect label. Added Type-Enhancement, Area-Library, Triaged labels.
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.
Ah, I didn't notice the missing parent link. I can just pull over an AVL implementation from java.
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.