Here you can find the source of next(Predicate
Parameter | Description |
---|---|
p | Predicate |
Parameter | Description |
---|---|
NullPointerException | if p is null |
static public TemporalAdjuster next(Predicate<LocalDate> p)
//package com.java2s; import java.time.LocalDate; import java.time.temporal.TemporalAdjuster; import java.util.Objects; import java.util.function.Predicate; public class Main { /**//www .ja v a 2 s .c om * Returns a TemporalAdjuster which returns the next date fulfilling the predicate. * @param p Predicate * @return a TemporalAdjuster * @throws NullPointerException if p is null */ static public TemporalAdjuster next(Predicate<LocalDate> p) { Objects.requireNonNull(p, "p is null"); return w -> { LocalDate result = (LocalDate) w; do { result = result.plusDays(1); } while (!p.test(result)); return result; }; } }