Java LocalDate query via method reference
import java.time.DayOfWeek; import java.time.LocalDate; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; public class Main { public static Boolean myQuery(TemporalAccessor temporal) { if (temporal.isSupported(ChronoField.DAY_OF_MONTH) && temporal.isSupported(ChronoField.DAY_OF_WEEK)) { int dayOfMonth = temporal.get(ChronoField.DAY_OF_MONTH); int weekDay = temporal.get(ChronoField.DAY_OF_WEEK); DayOfWeek dayOfWeek = DayOfWeek.of(weekDay); if (dayOfMonth == 3 && dayOfWeek == DayOfWeek.FRIDAY) { return Boolean.TRUE; }/*from www.j a v a 2s . c o m*/ } return Boolean.FALSE; } public static void main(String[] args) { LocalDate ld1 = LocalDate.of(2020, 12, 13); Boolean result = ld1.query(Main::myQuery); System.out.println(result); } }