[Solved] How do I sort my HashMap keys – they are not sorting? [closed]


You are approaching it wrong. What you want is:

1) Get the entrySet() from the Map.

2) Sort the entries by their value

3) Print the key of each sorted entry

What your program does is sort the keys alphabetically. And it does it fine.

5

solved How do I sort my HashMap keys – they are not sorting? [closed]