T
- type of tree node datapublic class Tree<T>
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
Tree() |
Tree(java.util.List<Node<T>> rootNodes) |
Tree(Node<T> root) |
Modifier and Type | Method and Description |
---|---|
Node<T> |
getRootNode()
Return the first root Node of the tree.
|
java.util.List<Node<T>> |
getRootNodes()
Return the root nodes of the tree.
|
void |
setRootNodes(java.util.List<Node<T>> rootNodes)
Set the root Element for the tree.
|
java.util.List<Node<T>> |
toList()
Returns the
Tree<T> as a List of Node<T> objects. |
java.lang.String |
toString()
Returns a String representation of the Tree.
|
public Node<T> getRootNode()
public java.util.List<Node<T>> getRootNodes()
public void setRootNodes(java.util.List<Node<T>> rootNodes)
rootNodes
- the root element to set.public java.util.List<Node<T>> toList()
Tree<T>
as a List of Node<T>
objects. The elements of the
List are generated from a pre-order traversal of the tree.List<Node<T>>
.public java.lang.String toString()
toString
in class java.lang.Object