title: When trying to insert contents of Hashmap into another hashmap after clearing contents creates issue
body: <p>I have three hashmaps</p>
  <pre><code>        HashMap&lt;Character, Integer&gt; hm1 = new HashMap&lt;Character, Integer&gt;();
          HashMap&lt;Character, Integer&gt; hm_temp = new HashMap&lt;Character, Integer&gt;();
          
          HashMap&lt;String, HashMap&lt;Character, Integer&gt;&gt; hm2 = new HashMap&lt;String, HashMap&lt;Character, Integer&gt;&gt;();
  </code></pre>
  <p>After I insert contents of hm1 into hm_temp  and then insert hm_temp contents in hm2</p>
  <pre><code>    hm_temp.putAll(hm1);        
      hm2.put(s, hm_temp);
  </code></pre>
  <p>Then I do clear contents of hm1 before inserting new data into hm1</p>
  <pre><code>        hm1.clear();
  </code></pre>
  <p>But the issue is when I clear hm1 it is clearing hash_temp data from hm2 as well. Could somebody elaborate what is the underlying issue here.</p>
  <pre><code>public class Groupduplicates {
  
      public static void main(String[] args) {
          
          String[] strArray = {&quot;crazy&quot;, &quot;zacry&quot;, &quot;means&quot;};
          
          
          HashMap&lt;Character, Integer&gt; hm1 = new HashMap&lt;Character, Integer&gt;();
          HashMap&lt;Character, Integer&gt; hm_temp = new HashMap&lt;Character, Integer&gt;();
          
          HashMap&lt;String, HashMap&lt;Character, Integer&gt;&gt; hm2 = new HashMap&lt;String, HashMap&lt;Character, Integer&gt;&gt;();
          
          int arrLen = strArray.length;
          
          for(String s: strArray)
          {
              
              System.out.println(hm1);
              
              char[] y = s.toCharArray();
              
              for(Character ch: y)
              {
                  if(hm1.containsKey(ch))
                      hm1.put(ch, hm1.get(ch)+1);
                  
                  else
                      hm1.put(ch, 1);
              }
              
              System.out.println(hm1);
              hm_temp.putAll(hm1);
              System.out.println(hm_temp);
              hm2.put(s, hm_temp);
              System.out.println(hm2);
              hm1.clear();
          }
  
          System.out.println(hm2);
          
          
  
      }
  
  }
  </code></pre>