我有一个hashMap,它具有以下值作为密钥value(sql date , integer)对:
a.put("31-05-2011",67);
a.put("01-06-2011",89);
a.put("10-06-2011",56);
a.put("25-05-2011",34);
Run Code Online (Sandbox Code Playgroud)
当我尝试使用以下键对hashMap进行排序时:Map modified_a = new TreeMap(a); 并按如下方式显示按键:
01-06-2011,10-06-2011,25-05-2011, 31-05-2011
Run Code Online (Sandbox Code Playgroud)
但我希望按键排序为
31-05-2011,25-05-2011,01-06-2011 ,10-06-2011
Run Code Online (Sandbox Code Playgroud)
我可以看到值是根据前2位数(这是日期值)进行排序的,但是我还要考虑月份值,并根据月份排序,然后按月对每个月进行排序.任何线索?