Merge pull request #139 from ably-forks/feature/iterator-at

Create a redblacktree iterator at a specific node
pull/143/head
Emir Pasic 4 years ago committed by GitHub
commit 7e23495895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,6 +28,11 @@ func (tree *Tree) Iterator() Iterator {
return Iterator{tree: tree, node: nil, position: begin}
}
// IteratorAt returns a stateful iterator whose elements are key/value pairs that is initialised at a particular node.
func (tree *Tree) IteratorAt(node *Node) Iterator {
return Iterator{tree: tree, node: node, position: between}
}
// Next moves the iterator to the next element and returns true if there was a next element in the container.
// If Next() returns true, then next element's key and value can be retrieved by Key() and Value().
// If Next() was called for the first time, then it will point the iterator to the first element if it exists.

Loading…
Cancel
Save