public static void main(String... args) { Year y = Year.of(1900); Boolean b = y.query(firstWorldWarPeriodQuery); System.out.println(b);
Year y2 = Year.of(1915); Boolean b2 = y2.query(firstWorldWarPeriodQuery); System.out.println(b2); }
private static final TemporalQuery<Boolean> firstWorldWarPeriodQuery = temporal -> { if (temporal.isSupported(ChronoField.YEAR)) { long l = temporal.getLong(ChronoField.YEAR); return l > 1914 && l < 1918; } return false; }; }