public Optional < ZonedDateTime > nextExecution ( final ZonedDateTime date ) { Preconditions . checkNotNull ( date ) ; try { ZonedDateTime nextMatch = nextClosestMatch ( date ) ; if ( nextMatch . equals ( date ) ) { nextMatch = nextClosestMatch ( date . plusSeconds ( 1 ) ) ; } return Optional . of ( nextMatch ) ; } catch ( final NoSuchValueException e ) { return Optional . empty ( ) ; } }
Provide nearest date for next execution .