I am using map interface to read from a file and then store the values in that as a key value pair.
Map<String, Integer> map = new HashMap<>();
The value is
A 25
D 10
B 15
E 15
C 17
I want to first sort by value in descending order Sorting the Map<Key,Value> in descending order based on the value . This will help to achieve the order in descending order. But if the value are duplicate i want to sort by key in ascending order.
Expected Output
A 25
C 17
B 15
E 15
D 10
Does any one know how to achieve this .