segregating data from database in datastructure
<p>i have a table which has cloumn :</p>

<pre><code>vaccine_date text ,vaccine_name text ,mother_id text  , child_id text ,address  text
</code></pre>

<p>on the same date for the same child this table can have mutiple vaccine so the column repeats for same date with different vaccine name .</p>

<p>I have to create a datastructure(HashMap) such the it should have date as key and all the vaccine name as Arraylist as a value to date. </p>

<p>I am not getting way out.Wrote some piece of code :</p>

<pre><code>HashMap&lt;String ,ArrayList&gt; hmap = new HashMap&lt;String,ArrayList&gt;();
        String [] vaclist =new String [10];
        String [] disdatelist = new String[20];
        //ArrayList&lt;String&gt; ashu =new ArrayList&lt;String&gt;(); 

        Cursor curdate=database.query(true,"calendar_updation", new String []{"vaccine_date"}, "child_id"+"="+ "?", new String []{childnme},null, null, null, null);
        while (curdate.moveToNext()){
            String distinctvacdate = curdate.getString(curdate.getColumnIndex("vaccine_date"));
            ArrayList&lt;String&gt; ashu_distinctvacdate =new ArrayList&lt;String&gt;();
            hmap.put(distinctvacdate, ashu_distinctvacdate);
        }
        // Addition of this part ends here 
        Cursor cur=database.query(true,"calendar_updation", new String []{"vaccine_date","vaccine_name","address"}, "child_id"+"="+ "?", new String []{childnme},null, null, null, null);
        while(cur.moveToNext()){
             // Addition for arraylist starts here 
            while (hmap.isEmpty()){
              if (hmap.equals(cur.getString(cur.getColumnIndex("vaccine_date")))){
                  String vaccinename = cur.getString(cur.getColumnIndex("vaccine_name"));  
                  ashu.add(vaccinename);
              }
              hmap.put(key, ashu);

            }
</code></pre>
