Here you can find the source of isValid(LocalDate ld1, LocalDate ld2, ZoneId zid, Predicate
public static boolean isValid(LocalDate ld1, LocalDate ld2, ZoneId zid, Predicate<Date> test)
//package com.java2s; //License from project: Apache License import java.time.*; import java.util.Date; import java.util.function.Predicate; public class Main { public static boolean isValid(LocalDate ld1, LocalDate ld2, ZoneId zid, Predicate<Date> test) { while (ld1.compareTo(ld2) != 0) { if (test.test(toDate(ld1.atStartOfDay(zid)))) return true; else// ww w .j a v a 2 s .co m ld1 = ld1.plusDays(1); } return false; } /** * */ public static Date toDate(Instant v) { return Date.from(v); } public static Date toDate(ZonedDateTime v) { return Date.from(v.toInstant()); } public static Date toDate(int y, int m, int d, int hh, int mm, int ss, int nano, ZoneId z) { return toDate(ZonedDateTime.of(y, m, d, hh, mm, ss, nano, z)); } }