use of com.github.drbookings.DateRange in project drbookings by DrBookings.
the class MainManager method fillMissing.
private void fillMissing() {
final List<LocalDate> dates = new ArrayList<>(uiDataMap.keySet());
Collections.sort(dates);
final Collection<LocalDate> toAdd = new HashSet<>();
LocalDate last = null;
for (final LocalDate d : dates) {
if (last != null) {
if (d.equals(last.plusDays(1))) {
// ok
} else {
toAdd.addAll(new DateRange(last.plusDays(1), d.minusDays(1)).toList());
}
}
last = d;
}
for (final LocalDate d : toAdd) {
addDateBean(new DateBean(d, this));
}
}