title: How to sort Map entries by values first, then by key and put the ordered keys in a List?
body: <p>I have an <a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" rel="nofollow">HashMap</a> :</p>
  
  <pre><code>private Map&lt;String,Integer&gt; matchesWonByTeam= new HashMap&lt;String,Integer&gt;();
  </code></pre>
  
  <ul>
  <li>I need to order those teams by matches won (value) and return an ArrayList with the names of the teams.</li>
  <li>If any of those teams have the same amount of matches won they need to be alphabetically ordered.</li>
  </ul>
  
  <p>What is the shortest and simplest way to do that using Collections and Comparators?</p>