title: Comparing two hashmaps for equal values and same key sets?
body: <p>How can I best compare two <code>HashMap</code>s, if I want to find out if none of them contains different keys than the other, and if the values of that keys match each other.</p>
  
  <pre><code>Map&lt;objA, objB&gt; mapA = new HashMap&lt;objA, objB&gt;();
  mapA.put("A", "1");
  mapA.put("B", "2");
  
  Map&lt;objA, objB&gt; mapB = new HashMap&lt;objA, objB&gt;();
  mapB.put("D", "4");
  mapB.put("A", "1");
  </code></pre>
  
  <p>When comparing A with B, it should fail due to different keys B and D.</p>
  
  <p>How could I best compare non-sorted hashmaps?</p>