I have a HashMap
like this:
Map<String, List<String>> map = new HashMap<>();
map.put("USA", Arrays.asList("CA","IA","IL"));
map.put("India", Arrays.asList("MUM","CAL"));
map.put("Canada", Arrays.asList("TOR"));
I want to sort the map depending on the size of the list value, in ascending order. How can I do that?
In this case, I would like the keys to be ordered Canada, India, USA.