Hi all!
Is there anyway to sort a TreeMap via it's keys and values? The keys are strings and values are integers. I wish to sort via the highest value, and then the key alphabetically
For example,
treemap.put("test", 5);
treemap.put("hello", 5);
treemap.put("face", 1);
treemap.put("lol", 8);
How can I make the output
lol - 8
hello - 5
test - 5
face - 1
At the moment, it just sorts the keys alphabetically.