Java Tree Implementation I wrote a simple tree data type in Java consisting of nodes which are themselves trees, and where each tree has its own list of children (not a binary tree). I plan on eventually using it in a minimax algorithm where I keep track of future game states in a board game by holding different board states in nodes and holding moves that lead to each state as edges in the tree. Here's my code so far — any suggestions (whether it be conceptual or performance related, or other features I should add) are appreciated:

public class Tree&lt;V, E&gt; {
   private V data;
   //here the edgeVal is the edge leading from the node's parent to the node itself,
   //not from the node to any of its children
   private E edgeVal;
   private Tree&lt;V, E&gt; parent;
   private ArrayList&lt;Tree&lt;V, E&gt;&gt; children;
   public Tree(V data, Tree&lt;V, E&gt; parent, E edgeVal) {
      this.data = data;
      this.edgeVal = edgeVal;
      this.parent = parent;
      this.children = new ArrayList&lt;Tree&lt;V, E&gt;&gt;();
   }
   public void addChild(V childData, E edgeVal) {
      Tree&lt;V, E&gt; child = new Tree&lt;V, E&gt;(childData, this, edgeVal);
      this.children.add(child);
   }
   public Tree&lt;V, E&gt; getParent() {
      return this.parent;
   }
   public ArrayList&lt;Tree&lt;V, E&gt;&gt; getChildren() {
      return this.children;
   }
   public V getData() {
      return this.data;
   }
   public E getEdgeVal() {
      return this.edgeVal;
   }
   public boolean isRoot() {
      return this.parent == null;
   }
   public boolean isLeaf() {
      return this.children.size() == 0;
   }
   public String toString() {
      //assuming type of data has a nicely defined toString() method
      return this.data.toString();
   }
}
Welcome to Code Review!


isLeaf compares the Size of children, a solution that is better readable is to use isEmpty() instead of compare the size of children.
The tree avoid a serialization that others may support, add the serializable-interface to keep serialization support.
edgeVal and data have no setter and to add final would help to avoid sideeffects whenever the code changes.
To have a ArrayList as a list of children has the problem that 


The ArrayList can contain null
The ArrayList can contain one element twice (i do not think its a case you like to have)


You better use some kind of set, a LinkedHashSet in example.
You can use getChildren() to have read-write-access to the children, if you do oscar.getChildren().add(oscar); your loop is perfect but not a Tree. Use the unmodifyable-functions of the class Collections to return a readonly-collection.
The class is named Tree that can contains a list of Tree. Even if a Tree can be a parasite to other Trees i propose to name the Class TreeNode.
toString should describe the node, not the data inside.
Am i the only one who write javadoc?