I have a Date/String TreeMap and I want to loop through the N last entries.
TreeMap<Date,String> map = new TreeMap<Date,String>();
map.put(new Date(2011,1,1), "32,1");
map.put(new Date(2011,3,1), "35");
map.put(new Date(2011,4,5), "38,9");
map.put(new Date(2011,8,2), "57!!");
Then I’m lost. I’ve found this :
NavigableSet<Date> dates = donnees.descendingKeySet();
Then I don’t know how to say something like :
for(key in dates and i ; i from 0 to N)
{ do something }
Any help ?
Or (equivalent):