Create an iterator at a specific node

pull/139/head
Paul Cruickshank 4 years ago
parent 80e934ed68
commit 962a86dc92

@ -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