create tree from linux directory stucture
<p>I need to create a tree from a linux directory stucture. For example:</p>

<pre><code>. 0
./file1.txt 1
./file2.txt 2
./site 3
./site/file3.txt 4
./site/ru 5
./site/ru/file4.txt 6
</code></pre>

<p>Each node is a directory or file(if it has no children) and has ID(>=0). The root ID is 0. Parent ID is always lower than child ID. I've created 2 classes:</p>

<pre><code>class Node&lt;T1, T2&gt; {
    T1 key;
    T2 value;

    List&lt;Node&lt;T1, T2&gt;&gt; children;

    Node(T1 key, T2 value) {
        this.key = key;
        this.value = value;
        children = new ArrayList&lt;Node&lt;T1, T2&gt;&gt;();
    }

    public boolean isFile()
    {
        return children.size() == 0;
    }
}
</code></pre>

<p>and </p>

<pre><code>public class DirectoryTree&lt;T1 extends Comparable&lt;T1&gt;, T2&gt; 
{
   private Node&lt;T1, T2&gt; root = null;

   public DirectoryTree(T1 key, T2 value)
   {
       root = new Node&lt;T1, T2&gt;(key, value);
   }
}
</code></pre>

<p>How can I fill the tree?</p>
