title: adding long key and arraylist value to hashmap
body: <p>I am getting db data this way</p>
  
  <h1>userid, dates</h1>
  
  <p>1125,3-05-2013 </p>
  
  <p>1125,4-05-2013 </p>
  
  <p>1125,5-05-2013 </p>
  
  <p>200,23-05-2013</p>
  
  <p>200,24-05-2013</p>
  
  <p>I need to add these to hashmap as hashmap(userid,dates).. </p>
  
  <p>i.e: hashmap(long,arraylist(string of dates)) and send to front end.</p>
  
  <p>I mean long value in hashmap should be unique, which is an key to retrive list of all dates for a particular user id,</p>
  
  <p>so if I try <code>hashmap.get(1125) ==  i</code> should get list of all dates for user 1125 like 3-05-2013,4-05-2013,5-05-2013</p>
  
  <p>then if I try  <code>hashmap.get(200) == i</code> should get list of all dates for user 200 like 23-05-2013,24-05-2013</p>
  
  <p>I tried this way , but I am getting all the dates for single userid like,</p>
  
  <p>users200
  dates[3-05-2013, 4-05-2013, 5-05-2013, 23-05-2013, 24-05-2013]</p>
  
  <p>Here is my code,</p>
  
  <pre><code>// TODO Auto-generated method stub
  
          List&lt;User&gt; myEmpls = new ArrayList&lt;User&gt;();
  
          User User1 = new User();
          User1.setEmpcode((long) 1125);
          User1.setDate("3-05-2013");
          myEmpls.add(User1);
  
          User User2 = new User();
          User2.setEmpcode((long) 1125);
          User2.setDate("4-05-2013");
          myEmpls.add(User2);
  
          User User5 = new User();
          User5.setEmpcode((long) 1125);
          User5.setDate("5-05-2013");
          myEmpls.add(User5);
  
          User User3 = new User();
          User3.setEmpcode((long) 200);
          User3.setDate("23-05-2013");
          myEmpls.add(User3);
  
          User User4 = new User();
          User4.setEmpcode((long) 200);
          User4.setDate("24-05-2013");
          myEmpls.add(User4);
  
  
  
          long prevUser=0;
          int cnt=1;
          long users =0;
          ArrayList&lt;ArrayList&lt;String&gt;&gt; lists = new ArrayList&lt;ArrayList&lt;String&gt;&gt;();
          HashMap&lt;Long, ArrayList&gt; finalmap =  new HashMap&lt;&gt;();
          ArrayList&lt;String&gt; dates = new ArrayList&lt;&gt;();
          for(User time : myEmpls)
          {
              if(prevUser==time.getEmpcode())
              {
                  users = time.getEmpcode();
                  System.out.println("users"+users);
                  dates.add(time.getDate());
              }
              else
              {
                  dates.add(time.getDate());
              }
              System.out.println("dates"+dates);
              finalmap.put(users, lists);
              prevUser =  time.getEmpcode();
              cnt++;
          }
  </code></pre>
  
  <p>can some one help me in this issue?</p>