title: How to compare two maps by their values
body: <p>How to compare two maps by their values? I have two maps containing equal values and want to compare them by their values. Here is an example:</p>
  
  <pre><code>    Map a = new HashMap();
      a.put("foo", "bar"+"bar");
      a.put("zoo", "bar"+"bar");
  
      Map b = new HashMap();
      b.put(new String("foo"), "bar"+"bar");
      b.put(new String("zoo"), "bar"+"bar");
  
      System.out.println("equals: " + a.equals(b));            // obviously false
  </code></pre>
  
  <p>How should I change the code to obtain a true?</p>