title: Create a Parent/child Data Structure from a Simple List
body: <p>I have a flat list like following. </p>
  
  <pre><code>nodeA           
   nodeB           
    nodeC           
    endnodeC   
    nodeD
    endnodeD
   endnodeB
  endnodeA 
  </code></pre>
  
  <p>Is there any way to create parent child data structure in java like folliwng.</p>
  
  <pre><code>   A               
     |              
     B             
    / \            
   C   D    
  </code></pre>