title: How print out the contents of a HashMap<String, String> in ascending order based on its values?
body: <p>I have this <code>HashMap</code> that I need to print out in ascending order according to the <strong><em>values</em></strong> contained in it (<strong><em>not the keys</em></strong>). </p>
  
  <p>But the order when I print it out is seemingly random. </p>
  
  <p>What's the best way to print it out in <strong><em>ascending value order</em></strong>?</p>
  
  <pre><code>Map&lt;String, String&gt; codes = new HashMap&lt;String, String&gt;();
  
  codes.put("A1", "Aania");
  codes.put("X1", "Abatha");
  codes.put("C1", "Acathan");
  codes.put("S1", "Adreenas");
  </code></pre>
  
  <p>In other words, the example above should print out as this:</p>
  
  <pre><code>A1, Aania
  X1, Abatha
  C1, Acathan
  S1, Adreenas
  </code></pre>