public IntervalList(List<Calendar> intervals) {
        super(intervals.size());

        int size = intervals.size();
        if (size % 2 != 0) {
            throw new IllegalArgumentException("Intervals parameter must be an odd number.");
        }

        Iterator<Calendar> it = intervals.iterator();

        while (it.hasNext()) {
            Calendar start = it.next();
            Calendar end = it.next();
            add(new Interval(start.getTimeInMillis(), end.getTimeInMillis()));
        }
    }