title: Arraylist retrieved from populated hashmap keeps returning an empty arraylist
body: <p>I have a hashmap and I am inserting an arraylist as the value in a while loop. During an iteration, if the hashmap already contains a key, I want to retreive the arraylist already stored, append new data to it and put it back into the hashmap. </p>
  
  <p>The issue I have now is when I check if a hashmap contains a value and it does, the arraylist being returned is of size 0 as though I never put in anything before. </p>
  
  <pre><code>final HashMap&lt;String, ArrayList&lt;String&gt;&gt; map = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;();
  String status = "";
  String channel = "";
  
  while (daily.next()) {
      while (avrg.next())
          if (avrg.getString(1).equals(daily.getString(1)) &amp;&amp; avrg.getString(2).equals(daily.getString(2))) {
              final Object pstmnt = null;
              final Object pstmnt2 = null;
              final float thresholdValue = calcThreshold(pstmnt, pstmnt2, daily.getString(1));
              channel = daily.getString("client_name");
              if (daily.getFloat(3) &gt; avrg.getFloat(3) + thresholdValue * avrg.getFloat(3)) {
                  status = "HIGHER";
              }
              else if (daily.getFloat(3) &lt; avrg.getFloat(3) - thresholdValue * avrg.getFloat(3)) {
                  status = "LOWER";
              }
              else {
                  status = "Normal";
              }
              final PrintStream out;
              out.println(channel);
              out.println(thresholdValue);
              out.println(status);
              if (map.containsKey(channel)) {
                  out.println("map contained key");
                  final ArrayList&lt;String&gt; temp = new ArrayList&lt;String&gt;();
                  temp.addAll(map.get(channel));
                  out.println("previous size: " + temp.size());
  
                  temp.add(daily.getString("event"));
                  temp.add(Float.toString(daily.getFloat(3)));
                  temp.add(Float.toString(avrg.getFloat(3)));
                  temp.add(Float.toString(thresholdValue * 100));
                  temp.add(status);
                  out.println("current size: " + temp.size());
                  map.put(channel, temp);
                  out.println("array added to map");
                  temp.clear();
                  System.out.println("done");
  
              }
  
              else {
                  final ArrayList&lt;String&gt; temp = new ArrayList&lt;String&gt;();
                  out.println("new key created");
                  temp.add(daily.getString("event"));
                  temp.add(Float.toString(daily.getFloat(3)));
                  temp.add(Float.toString(avrg.getFloat(3)));
                  temp.add(Float.toString(thresholdValue * 100));
                  temp.add(status);
  
                  System.out.println(temp.size());
                  map.put(channel, temp);
                  System.out.println("array added to map");
              }
          }
      avrg.beforeFirst();
  }   
  </code></pre>
  
  <p>I am really not sure why this is happening. Any help would be appreciated! </p>