I have a Map, with keys and values in it
Keys:- case 1, case 2......case 10
Values:- Jan, Feb......Oct
Now when i put this map in array list (so that i can sort it)
for (String key : dataValueMap.keySet()) {
System.out.println(key + " " + dataValueMap.get(key));
}
ArrayList<String> keys = new ArrayList<String>(
dataValueMap.keySet());
Collections.sort(keys);
for (String counter : keys) {
System.out.println(counter); >>>>>BUT it prints like :- case 1 then case 10 then case 2, case 3, case 4 etc.
}
Kindly help in fixing this issue,
Thanks in advance
ArrayList<String>with the strings. The fact that they happened to be keys in a map is irrelevant.