@Beta @GwtCompatible public abstract class BinaryTreeTraverser<T> extends TreeTraverser<T>
TreeTraverser for binary trees, providing additional traversals specific to
binary trees.| Modifier and Type | Class and Description |
|---|---|
private class |
BinaryTreeTraverser.InOrderIterator |
private class |
BinaryTreeTraverser.PostOrderIterator |
private class |
BinaryTreeTraverser.PreOrderIterator |
| Constructor and Description |
|---|
BinaryTreeTraverser() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Iterable<T> |
children(T root)
Returns the children of this node, in left-to-right order.
|
FluentIterable<T> |
inOrderTraversal(T root) |
abstract Optional<T> |
leftChild(T root)
Returns the left child of the specified node, or
Optional.absent() if the specified
node has no left child. |
(package private) UnmodifiableIterator<T> |
postOrderIterator(T root) |
(package private) UnmodifiableIterator<T> |
preOrderIterator(T root) |
private static <T> void |
pushIfPresent(java.util.Deque<T> stack,
Optional<T> node) |
abstract Optional<T> |
rightChild(T root)
Returns the right child of the specified node, or
Optional.absent() if the specified
node has no right child. |
breadthFirstTraversal, postOrderTraversal, preOrderTraversal, usingpublic abstract Optional<T> leftChild(T root)
Optional.absent() if the specified
node has no left child.public abstract Optional<T> rightChild(T root)
Optional.absent() if the specified
node has no right child.public final java.lang.Iterable<T> children(T root)
children in class TreeTraverser<T>UnmodifiableIterator<T> preOrderIterator(T root)
preOrderIterator in class TreeTraverser<T>UnmodifiableIterator<T> postOrderIterator(T root)
postOrderIterator in class TreeTraverser<T>public final FluentIterable<T> inOrderTraversal(T root)
private static <T> void pushIfPresent(java.util.Deque<T> stack,
Optional<T> node)