I have a hashMap which has the following values as key value(sql date , integer) pairs:
a.put("31-05-2011",67);
a.put("01-06-2011",89);
a.put("10-06-2011",56);
a.put("25-05-2011",34);
when i try to sort the hashMap based on the keys using :
Map modified_a=new TreeMap(a);
and display the keys it is as follows :
01-06-2011,10-06-2011,25-05-2011, 31-05-2011
but I want the keys to be sorted as
31-05-2011,25-05-2011,01-06-2011 ,10-06-2011
I can see that the values are being sorted based on the first 2 digits( which is the date value) but I need the month value to also be considered and sort based on months first and then for each month sort the corresponding days.
Any clues ??
You can use like