@Beta @GwtCompatible(emulated=true) public abstract class BinaryTreeTraverser<T> extends TreeTraverser<T>
A variant of TreeTraverser
for binary trees, providing additional traversals specific to binary trees.
Constructor and Description |
---|
BinaryTreeTraverser() |
Modifier and Type | Method and Description |
---|---|
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.empty() if the specified node has no left child. |
abstract Optional<T> |
rightChild(T root)
Returns the right child of the specified node, or
Optional.empty() if the specified node has no right child. |
breadthFirstTraversal, postOrderTraversal, preOrderTraversal
public abstract Optional<T> leftChild(T root)
Returns the left child of the specified node, or Optional.empty()
if the specified node has no left child.
public abstract Optional<T> rightChild(T root)
Returns the right child of the specified node, or Optional.empty()
if the specified node has no right child.
public final Iterable<T> children(T root)
Returns the children of this node, in left-to-right order.
children
in class TreeTraverser<T>
public final FluentIterable<T> inOrderTraversal(T root)