public class BinaryTreePrinter<T> extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
BinaryTreePrinter.Branch |
static class |
BinaryTreePrinter.Builder<T> |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> BinaryTreePrinter.Builder<T> |
builder(Function<T,String> nodeLabel,
UnaryOperator<T> leftChild,
UnaryOperator<T> rightChild) |
void |
print(List<T> trees,
int lineWidth)
Prints ascii representations of multiple trees across page.
|
void |
print(T root)
Prints ascii representation of binary tree.
|
public void print(T root) throws IOException
IOExceptionpublic void print(List<T> trees, int lineWidth) throws IOException
trees - the multiple treelineWidth - 行的宽度:小于该宽度则多棵树水平排列,否则换行后再来打印下一棵树IOExceptionpublic static <T> BinaryTreePrinter.Builder<T> builder(Function<T,String> nodeLabel, UnaryOperator<T> leftChild, UnaryOperator<T> rightChild)
Copyright © 2024. All rights reserved.