Is there any standard Java library class to represent a tree in Java?
Specifically I need to represent the following:
For example :
import java.util.ArrayList;
import java.util.List;
/**
*
* @author X2
*
* @param
*/
public class HisTree
{
private Node root;
public HisTree(T rootData)
{
root = new Node();
root.setData(rootData);
root.setChildren(new ArrayList>());
}
}
class Node
{
private T data;
private Node parent;
private List> children;
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public Node getParent() {
return parent;
}
public void setParent(Node parent) {
this.parent = parent;
}
public List> getChildren() {
return children;
}
public void setChildren(List> children) {
this.children = children;
}
}