T
- value typepublic static final class Tree.Node<T> extends Object implements Tree<T>, Serializable
Tree.Empty<T>, Tree.Node<T>, Tree.Order
Constructor and Description |
---|
Node(T value,
List<Tree.Node<T>> children)
Constructs a rose tree branch.
|
Modifier and Type | Method and Description |
---|---|
String |
draw()
Creates a neat 2-dimensional drawing of a tree.
|
boolean |
equals(Object o)
Clarifies that values have a proper equals() method implemented.
|
List<Tree.Node<T>> |
getChildren()
Returns the children of this tree.
|
T |
getValue()
Gets the value of this tree.
|
int |
hashCode()
Clarifies that values have a proper hashCode() method implemented.
|
boolean |
isEmpty()
Checks if this Traversable is empty.
|
boolean |
isLeaf()
Checks if this Tree is a leaf.
|
int |
size()
Returns the number of nodes (including root and leafs).
|
String |
toString()
Clarifies that values have a proper toString() method implemented.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
branchCount, collector, distinct, distinctBy, distinctBy, drop, dropRight, dropUntil, dropWhile, empty, fill, filter, flatMap, foldRight, groupBy, grouped, hasDefiniteSize, head, headOption, init, initOption, isBranch, isTraversableAgain, iterator, iterator, leafCount, length, map, narrow, nodeCount, of, of, of, of, ofAll, partition, peek, replace, replaceAll, retainAll, scan, scanLeft, scanRight, sliding, sliding, span, spliterator, stringPrefix, tabulate, tail, tailOption, take, takeRight, takeUntil, takeWhile, transform, traverse, traverse, unzip, unzip3, values, values, zip, zipAll, zipWithIndex
average, containsAll, count, existsUnique, find, findLast, foldLeft, get, hash, isSingleValued, last, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkString, mkString, mkString, narrow, nonEmpty, product, reduceLeft, reduceLeftOption, reduceRight, reduceRightOption, sum
fold, reduce, reduceOption
contains, corresponds, eq, exists, forAll, forEach, getOption, getOrElse, getOrElse, getOrElseThrow, getOrElseTry, narrow, out, out, stderr, stdout, toArray, toCharSeq, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaOptional, toJavaSet, toJavaSet, toJavaStream, toLeft, toLeft, toList, toMap, toOption, toQueue, toRight, toRight, toSet, toStack, toStream, toTree, toTry, toTry, toVector
public Node(T value, List<Tree.Node<T>> children)
value
- A value.children
- A non-empty list of children.NullPointerException
- if children is nullIllegalArgumentException
- if children is emptypublic List<Tree.Node<T>> getChildren()
Tree
getChildren
in interface Tree<T>
public boolean isEmpty()
Traversable
public boolean isLeaf()
Tree
public int size()
Tree
public boolean equals(Object o)
Value
public int hashCode()
Value
See Object.hashCode().
public String toString()
Value
See Object.toString().
Copyright © 2016. All Rights Reserved.