Reputation: 37
I need to sort this TreeMap by values and if value is the same like 1 or 2 in this case then I need to sort these elements by their keys. How can I do it?
{65=2, 67=1, 69=4, 72=2, 73=5, 77=1, 78=2, 79=3, 81=1, 83=7, 84=6, 85=2, 87=2, 89=1}
So the result would looks like this
{83=7, 84=6, 73=5, 69=4, 79=3, 65=2, 72=2, 78=2, 85=2, 87=2, 67=1, 77=1, 81=1, 89=1}
Thank you for help.
Upvotes: 1
Views: 93