title: Convert One-Dimensional ArrayList to Two Dimensions
body: <p>I currently have a scenario where, using JDBC, I dump a ResultSet into a single ArrayList:</p>
  
  <pre><code>while(rs.next()) { 
            singleSessionRecords.add(new SessionRecord(rs.getString("SessionID"),rs.getString("NetworkAddress"),rs.getString("EventType"),rs.getString("Time"),rs.getString("Name"),rs.getString("SessionType"),rs.getString("ProcessType"))); 
        }
  </code></pre>
  
  <p>This part is confirmed to be working. However, for easier manipulation, I need to alter this single dimensional and place it into a two-dimensional ArrayList. The key here is that I need the second dimension to be split by <code>SessionRecord.SessionID</code>. For Example:</p>
  
  <pre><code>groupedSessionRecords (Outer ArrayList)
      SessionID 1 (Inner ArrayList)
          Session Record 1
          Session Record 2
          Session Record 3
      SessionID 2 (Inner ArrayList)
          Session Record 4
          Session Record 5
          Session Record 6
  </code></pre>
  
  <p>It continues in this format, but with varying amounts of records per SessionID. Is there any easy, elegant way to achieve this? My only current idea is to loop through the entirety of the existing ArrayList with a temporary one that I clear each time I reach a new SessionID.</p>