Sort a Map first by value then by Key
<p>I have a <code>Map&lt;String, Integer&gt;</code> and I want to sort it first on the values (descending order) then on the key.
Eg: I have </p>

<pre><code>map.put("A", 5)
map.put("B", 3)
map.put("C", 2)
map.put("D", 6)
map.put("E", 3)
map.put("F", 5)
</code></pre>

<p>Result should be after Sort :</p>

<pre><code>("D", 6)
("A", 5)
("F", 5)
("B", 3)
("E", 3)
("C", 2)
</code></pre>

<p>The values are in descending order and if two or more keys have same value then they should be sorted alphabetically.</p>

<p>Can anyone tell me a better approach of doing this. </p>
