awaitility/src/main/java/org/awaitility/core/ConditionFactory.java
private Duration definePollDelay(Duration pollDelay, PollInterval pollInterval) {
        final Duration pollDelayToUse;
        // If a poll delay is null then a poll delay has not been explicitly defined by the user
        if (pollDelay == null) {
            if (pollInterval != null && pollInterval instanceof FixedPollInterval) {
                pollDelayToUse = pollInterval.next(1, Duration.ZERO); // Will return same poll delay as poll interval
            } else {
                pollDelayToUse = Duration.ZERO; // Default poll delay for non-fixed poll intervals
            }
        } else {
            // Poll delay was explicitly defined, use it!
            pollDelayToUse = pollDelay;
        }
        return pollDelayToUse;
    }
private Duration definePollDelay(Duration pollDelay, PollInterval pollInterval) {
        final Duration pollDelayToUse;
        // If a poll delay is null then a poll delay has not been explicitly defined by the user
        if (pollDelay == null) {
            if (pollInterval != null && pollInterval instanceof FixedPollInterval) {
                pollDelayToUse = pollInterval.next(1, Duration.ZERO); // Will return same poll delay as poll interval
            } else {
                pollDelayToUse = Duration.ZERO; // Default poll delay for non-fixed poll intervals
            }
        } else {
            // Poll delay was explicitly defined, use it!
            pollDelayToUse = pollDelay;
        }
        return pollDelayToUse;
    }
private Duration definePollDelay ( Duration pollDelay , PollInterval pollInterval ) { final Duration pollDelayToUse ; // If a poll delay is null then a poll delay has not been explicitly defined by the user if ( pollDelay == null ) { if ( pollInterval != null && pollInterval instanceof FixedPollInterval ) { pollDelayToUse = pollInterval . next ( 1 , Duration . ZERO ) ; // Will return same poll delay as poll interval } else { pollDelayToUse = Duration . ZERO ; // Default poll delay for non-fixed poll intervals } } else { // Poll delay was explicitly defined, use it! pollDelayToUse = pollDelay ; } return pollDelayToUse ; }
Ensures backward compatibility (especially that poll delay is the same as poll interval for fixed poll interval).
It also make sure that poll delay is {@link Duration#ZERO} for all other poll intervals if poll delay was not explicitly
defined. If poll delay was explicitly defined the it will just be returned.

@param pollDelay    The poll delay
@param pollInterval The chosen (or default) poll interval
@return The poll delay to use
Ensures backward compatibility ( especially that poll delay is the same as poll interval for fixed poll interval ) . It also make sure that poll delay is { @link Duration#ZERO } for all other poll intervals if poll delay was not explicitly defined . If poll delay was explicitly defined the it will just be returned .