java build list of lists from sorted Map
<p>Okay for layout purposes on my JSP I need to build a lits of lists.</p>

<p>Here is the issue. In PlannedBeans each bean has a map that has a month/ # pair.</p>

<p>it looks something like this if you only iterate over the months in the map:</p>

<pre><code> 2013-01-01    2012-12-01    2012-11-01    2012-10-01    
              2013-01-01    2012-12-01    2012-11-01    
 2013-01-01    2012-12-01    
</code></pre>

<p>As you can each iteartion of the bean does not have the same # of months.</p>

<p>For purposes of laying out in a uniform table.  I want to make the lists the same size, so where there are gaps, fill in with null or 0 maybe?</p>

<p>This is what's inside of "plannedBeans"</p>

<pre><code>List&lt;DlhUnitBean&gt; plannedBeans 
</code></pre>

<p>This is what's inside DlhUnitBean:</p>

<pre><code>public int getUnitNumber() { return unitNumber; }
public SortedMap&lt;Date, DlhPhasing&gt; getPlannedDlhByMonth() { return phasing; }
</code></pre>

<p>This is what is inside of the map DlhPhasing:</p>

<pre><code> public Date getMonth() { return month; }
 public double getPlannedDlh() { return planDlh; }
</code></pre>

<p>When I went to build the header columns to get the max size of the list, this helped determing that:</p>

<pre><code> TreeSet&lt;Date&gt; monthList = new TreeSet&lt;Date&gt;();
         for (DlhUnitBean dlh:  plannedBeans)

       {
          for(Entry&lt;Date, DlhPhasing&gt; en : dlh.getPlannedDlhByMonth().entrySet() )
           {
              //System.out.println( en.getKey() );
              monthList.add(en.getKey());
           }
       }
</code></pre>

<p>For the purposes of this question I need to fill in the gaps of bean lists so they all have the same # of values</p>

<p>Thanks for your help</p>
