i want sort this Map:
Map<String, Collection<String[]>> map = new HashMap<String, Collection<String[]>>();
In map is for example:
String key = "MyKey";
Collection<String[]> values = new ArrayList<String[]>();
map.put(key, values);
String[] firstValues = { "John", "21", "M"};
values.add(firstValues); //Name, Age, Gender
String[] secondValues = { "Jane", "31", "W"};
values.add(secondValues);
etc.
so finnaly, i have: map with:
Mykey : [["John", "21", "M"], ["Eve", "31", "W"]];
And i want do:
Collection<String[]> values = map.get(key);
and then sort by specific index, for example by first index(name) alphabetically, or by second index(age). So after first sort will be:
Mykey : [["Eve", "31", "W"], ["John", "21", "M"]];
after second sort:
Mykey : [["John", "21", "M"], ["Eve", "31", "W"]];
Collectionis not necessarily ordered. You might want to useListinstead.