public static Interval getIntervalFrom(List<LoadTimeLine> timeLines) { GanttDate start = null; GanttDate end = null; for (LoadTimeLine loadTimeLine : timeLines) { if (!loadTimeLine.isEmpty()) { Validate.notNull(loadTimeLine.getStart()); start = min(start, loadTimeLine.getStart()); Validate.notNull(loadTimeLine.getEnd()); end = max(end, loadTimeLine.getEnd()); } } if (timeLines.isEmpty() || start == null || end == null) { LocalDate localDateNow = new LocalDate(); return new Interval(localDateNow, localDateNow.plusYears(5)); } return new Interval(start.toLocalDate(), end.asExclusiveEnd()); }