Converting an ArrayList<HashMap> into a multidimensional List
<p>I have an ArrayList of HashMap elements that has a format of Category, Activity and Time.  I.E.</p>

<pre><code>{CATEGORY=Planning, ACTIVITY=Bills, TIME=5}
{CATEGORY=Planning, ACTIVITY=Bills, TIME=7}
{CATEGORY=Planning, ACTIVITY=Meetings, TIME=10}
{CATEGORY=Resources, ACTIVITY=Room1, TIME=15}
....
</code></pre>

<p><i>Take note of the CATEGORY/ACTIVITY pair that is repeated as that can happen in the List</i></p>

<p>I need to be able to convert this List into a multidimensional one.  The best way I can think of for how this List needs to look is by writing some pseudocode...please see that at the bottom of the post.</p>

<p>I've thought of several different approaches on how to implement this but I'm quite frankly stuck and frustrated at how to do this.  I've thought of taking the inefficient approach of looping through the ArrayList several times in outer and inner loops but I know that wouldn't be good coding practice.</p>

<p>Any suggestions on how I can implement this conversion so I can loop like in the pseudocode below?</p>

<pre><code>For CATEGORY in CATEGORIES {
    CategoryTime = 0
    Display Category Header
    For ACTIVITY in ACTIVITIES {
        Activity Time = 0
        For TIME_RECORD in ACTIVITY
            Add time to activity total time, category total time &amp; grand total
        }
        Display Activity Total
    }
    Display Category Total
}
Display Grand Total and rest of information...
</code></pre>

<p><b>Edit</b>
I appreciate all the feedback given for this problem and it appears that really the best way to go is to enhance a class that the ArrayList of HashMap elements is a member of.</p>

<p>I've put in a vote to close this question as has another person as it's too localized.  I would appreciate it if some of you other developers would follow suit to close the question.  I would delete it but I can't at this point because there are answers to the question.</p>
