Java Tree Struct & Breadth-first-search
<p>I created a simple parameterized tree structure, based on a root Node. Each node holds a arraylist of its childnotes and a link to its parent. Thats simple.</p>

<p>Now a problem that I'm not able to solve (in near future):</p>

<p>I want to write a breadth-first search over this tree. I want to implement this feature with the help of a (implemented) iterator interface. But I'm really unable to bring this to work:
Problem is the also iterable List-structure. I don't know how to implement the hasNext(), next() and remove() functions :/</p>

<p>Do you have any idea?</p>

<p>Greetings</p>

<p><strong>Code:</strong></p>

<pre><code>public class Tree&lt;T&gt; implements Iterator&lt;T&gt;{

private Node&lt;T&gt; root;

/**
 * Default constructor.
 */
public Tree() {
    super();        
}

/**
 * Return the root Node of the tree.
 * @return the root element.
 */    
public Node&lt;T&gt; getRoot() {
    return this.root;
}

/**
 * Set the root Element for the tree.
 * @param Root the root element to set.
 */
public void setRoot(Node&lt;T&gt; Root) {
    this.root = Root;
}
...
</code></pre>

<p><strong>and</strong> </p>

<p>public class Node {</p>

<pre><code>public List&lt;Node&lt;T&gt;&gt; children;
public Node&lt;T&gt; parent;
public T data;

/**
 * Default constructor.
 */
public Node() {
    super();
}

/**
 * Create a Node&lt;T&gt; with an instance of T.
 * @param data an instance of T.
 */
public Node(T nodeData) {
    this();
    setData(nodeData);        
}

/**
 * Create a Node&lt;T&gt; with an instance of T.
 * @param data an instance of T.
 */
public Node(T nodeData, Node&lt;T&gt; parentNode) {
    this();       

    setData(nodeData);
    setParent(parentNode); 

}
...   
</code></pre>
