@InterfaceAudience.Private public static class AvlUtil.AvlTreeIterator<TNode extends AvlUtil.AvlNode> extends Object implements Iterator<TNode>
Modifier and Type | Field and Description |
---|---|
private TNode |
current |
private int |
height |
private Object[] |
stack |
Constructor and Description |
---|
AvlTreeIterator() |
AvlTreeIterator(TNode root)
Create the iterator starting from the first (min) node of the tree
|
AvlTreeIterator(TNode root,
Object key,
AvlUtil.AvlKeyComparator<TNode> keyComparator)
Create the iterator starting from the specified key
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
TNode |
next() |
void |
remove() |
void |
seekFirst(TNode root)
Reset the iterator, and seeks to the first (min) node of the tree
|
private void |
seekNext() |
void |
seekTo(TNode root,
Object key,
AvlUtil.AvlKeyComparator<TNode> keyComparator)
Reset the iterator, and seeks to the specified key
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
private TNode extends AvlUtil.AvlNode current
private int height
public AvlTreeIterator()
public AvlTreeIterator(TNode root)
root
- the current root of the treepublic AvlTreeIterator(TNode root, Object key, AvlUtil.AvlKeyComparator<TNode> keyComparator)
root
- the current root of the treekey
- the key for the node we are trying to findkeyComparator
- the comparator to use to match node and keypublic boolean hasNext()
hasNext
in interface Iterator<TNode extends AvlUtil.AvlNode>
public void remove()
remove
in interface Iterator<TNode extends AvlUtil.AvlNode>
public void seekFirst(TNode root)
root
- the current root of the treepublic void seekTo(TNode root, Object key, AvlUtil.AvlKeyComparator<TNode> keyComparator)
root
- the current root of the treekey
- the key for the node we are trying to findkeyComparator
- the comparator to use to match node and keyprivate void seekNext()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.