I'm using Joda-Time library in Java to keep track a list of time intervals. I want to check if a list of Interval objects fully covers every minute of a month. There's about 30 intervals of varying length from a few hours to a few days.
I thought a cheap way to do this is to sort the list of intervals by start time, then successively check if there is a break between the intervals within the range of the month. If yes, then the month is not fully covered.
I'm stuck on the first part, sorting the list. I planned to use Arrays.sort(), but it needs the elements to implement the comparable interface. However, after looking through the source, Joda-Time's Interval class doesn't seem to have one I can override, and I can't extend it to write my own compareTo method.
Other than writing my own sorting method, anyone know an easier way to accomplish this? Thanks