use of com.github.robozonky.app.portfolio.Delinquents in project robozonky by RoboZonky.
the class Delinquency method getOlderThan.
/**
* Returns all loans that are presently delinquent.
* @param days Minimum number of days a loan is in delinquency in order to be reported. 0 returns all delinquents.
* @return All loans that are delinquent for more than the given number of days.
*/
private SortedMap<Integer, LocalDate> getOlderThan(final int days) {
final ZoneId zone = Defaults.ZONE_ID;
final ZonedDateTime now = LocalDate.now().atStartOfDay(zone);
return source.get().flatMap(d -> d.getActiveDelinquency().map(Stream::of).orElse(Stream.empty())).filter(d -> d.getPaymentMissedDate().atStartOfDay(zone).plusDays(days).isBefore(now)).collect(Collectors.toMap(d -> d.getParent().getLoanId(), d -> d.getPaymentMissedDate(), (a, b) -> a, TreeMap::new));
}
Aggregations