I have a Map<DateTime,Integer> rawCount, which contains raw count per date (a time-series).
I want to construct an aggregate map which will contains count during a specific interval.
For instance, if duration = (1000*1*60*60) and start = new DateTime() this map will contains total count per hour from now to the last date in the rawCount map.
I am using JodaTime, as Interval is not Comparable and I want the Map to be ordered from the most recent to the oldest date, using a TreeMap is not possible.
I am confused on which Object will be the best for my use case (is Interval appropriate?) and how to write this function.
This is how I would solve it.