I have below hashmap
like below:
Map<String, Integer> map = new HashMap<String, Integer>();
map.put("a", 4);
map.put("b", 9);
map.put("c", 1);
I want to sort the hashmap based by their value, it should give output like :
[1, 4, 9]
Is this possible using Comparator?
UPDATE: Link provided does not provide the solution, I tried the solution, created hashmap cannot be traversed by key.