title: How to putAll on Java hashMap contents of one to another, but not replace existing keys and values?
body: <p>I need to copy all keys and values from one A HashMap onto another one B, but not to replace existing keys and values.</p>
  
  <p>Whats the best way to do that?</p>
  
  <p>I was thinking instead iterating the keySet and checkig if it exist or not, I would</p>
  
  <pre><code>Map temp = new HashMap(); // generic later
  temp.putAll(Amap);
  A.clear();
  A.putAll(Bmap);
  A.putAll(temp);
  </code></pre>