title: Looping to enter values into Java Hashmap
body: <p>i am trying to insert values into a hashmap. I have it in a loop as the values are being retrieved from a list of strings. The code is as follows:</p>
  
  <pre><code>HashMap&lt;String, String&gt; resultHashMap = new HashMap&lt;String, String&gt;();
  
  //add the top document id back to the resultHashMap
  resultHashMap.put("entryObject", dsStepParam.getValue());
  
  for(String res : results) 
  {
      log.info(res);
      resultHashMap.put("dataObject", res);
  }
  </code></pre>
  
  <p>The hashMap (after this loop should contain the following:</p>
  
  <pre><code>{"entryObject":"500386787",
  "dataObject":"500386883;500901929",
  "dataObject":"500386906;500901969",
  "dataObject":"500386787;500901666",
  "dataObject":"500386784;500901654",
  "dataObject":"500386762;500901599"}
  </code></pre>
  
  <p>however the actual contents are:</p>
  
  <pre><code>{"entryObject":"500386787",
  "dataObject":"500386762;500901599"}
  </code></pre>
  
  <p>As you can see it only stores the entryObject and the last dataObject.
  How can I make it store all the values in the hashMap?</p>