Class Tree.TreeNode<T>
java.lang.Object
com.luchersol.core.util.collection.Tree.TreeNode<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(Tree.TreeNode<T> child) Adds a child node to this node.booleanisLeaf()Checks if this node is a leaf (has no children).
-
Field Details
-
value
The value stored in this tree node. It can be of any generic type. -
children
The list of child nodes of this node. Each element in the list is aTree.TreeNoderepresenting a subtree. Initially, the list is empty.
-
-
Constructor Details
-
TreeNode
Constructs a tree node with the specified value.- Parameters:
value- the value to store in the node
-
-
Method Details
-
addChild
Adds a child node to this node.- Parameters:
child- the child node to add
-
isLeaf
public boolean isLeaf()Checks if this node is a leaf (has no children).- Returns:
- true if the node is a leaf, false otherwise
-