i have hashmap key type calendar, such as:
hashmap <calendar, student> map = new hashmap <calendar, student> ();
and once sort map dates, want check if each calendar (key) in map consecutive per student name; example, suppose data in map this:
('10-01-2015', student1), ('10-02-2015', student1), ('10-03-2015', student1), ('10-10-2015', student1), ('10-11-2015', student2), ('10-13-2015', student2)
and on.
then want have result below:
student1: 10-01-2015 - 10-03-2015 student1: 10-10-2015 student2: 10-11-2015 student2: 10-13-2015
i think going use treemap sort map, not sure how group consecutive keys per value.
how approach?
you can loop , inside of this..
simpledateformat sdf = new simpledateformat("dd-mm-yyyy"); calendar c = calendar.getinstance(); c.settime(sdf.parse(yourkey/date)); calendar pd = c;//previous date c.add(calendar.date, 1); // number of days add
and check if c.gettime = dt.gettime
Comments
Post a Comment