title: combination of hashmap with arraylist for making complex structure
body: <p>last 3 days i am spending time to get the following structure working but i wont be able to figure out that how to get the structure working</p>
  
  <pre><code>array
    1 =&gt; 
      array
        0 =&gt; 
          array
            'id' =&gt; '1'
            'name' =&gt; 'xyz'
        1 =&gt; 
          array
            'id' =&gt; '12'
            'name' =&gt; 'xyz1'
        2 =&gt; 
          array
            'id' =&gt; '54'
            'name' =&gt; 'xyz12'
    20 =&gt; 
      array
        0 =&gt; 
          array
            'id' =&gt; '1'
            'name' =&gt; 'xyz'
        1 =&gt; 
          array
            'id' =&gt; '12'
            'name' =&gt; 'xyz1'
        2 =&gt; 
          array
            'id' =&gt; '54'
            'name' =&gt; 'xyz12'
        3 =&gt; 
          array
            'id' =&gt; '566'
            'name' =&gt; 'xyz1234'
  </code></pre>
  
  <p>i tried following thing but i wont be able to move forward</p>
  
  <pre><code>Map&lt;Integer, ArrayList&lt;HashMap&lt;String, Object&gt;&gt;&gt; data  = new HashMap&lt;Integer, ArrayList&lt;HashMap&lt;String, Object&gt;&gt;&gt;();
  </code></pre>
  
  <p>i have a resultset, in that i have information as follows</p>
  
  <pre><code>id               | name                      | element_id
  ______________________________________________________________
  1                | xyz                       | 1
  ______________________________________________________________
  1                | xyz                       | 3
  ______________________________________________________________
  12               | xyz1                      | 1
  ______________________________________________________________
  54               | xyz11                     | 1
  ______________________________________________________________
  566              | xyz1234                   | 3
  ______________________________________________________________
  12               | xyz1                      | 3
  ______________________________________________________________
  54               | xyz11                     | 3
  ______________________________________________________________
  </code></pre>
  
  <p>My code is</p>
  
  <pre><code>while (resultSET.next()) 
  {
      Map&lt;String, Object&gt; tag = new HashMap&lt;String, Object&gt;();
      tag.put("name", resultSET.getString(3));
      tag.put("id", resultSET.getInt(2));
  
      tags.put(resultSET.getInt(1), tag);
  }
  </code></pre>