title: Java tree structure with multiple children (sorted) at each level
body: <p>I'm working with a flat List of objects, which nevertheless are associated with each other in parent-child relationships.  An object may have any number of children, or none at all.  I need to display these objects as a tree, showing those relationships.  Each level of the tree should be sorted (the objects <em>are</em> compatible with <code>Collections.sort()</code> ).  </p>
  
  <p>The question is two-part:</p>
  
  <ol>
  <li><p>Does Java have a good out-of-the-box data structure for holding such a tree, or do I need to write one from scratch?  (not a huge task, but there's no sense in reinventing the wheel)  I know about <code>DefaultTreeModel</code> in Swing... but this application is running on the server-side, and use of the Swing package will get frowned upon in code review.</p></li>
  <li><p>What would be the best pattern for loading a flat List into such a data-structure?  My first thought is to identify the root-level objects, and then use a recursive method to traverse down through their children, grandchildren, etc.  However, for the requirement of sorting the peers at each level in the tree... I'm not sure if it makes more sense to worry about this when I'm building the tree, or worry about it later when I'm parsing the tree for display.</p></li>
  </ol>