code: public RetryWhenFunction build() {
      RetryWithDelayHandler handler;
      Func1<Throwable, Boolean> filter;
      if ((errorsStoppingRetry == null || errorsStoppingRetry.isEmpty()) && retryErrorPredicate == null) {
        //always retry on any error
        filter = null;
      } else if (retryErrorPredicate != null) {
        filter = new InversePredicate(retryErrorPredicate);
      } else {
        filter = new ShouldStopOnError(errorsStoppingRetry, inverse);
      }
  
      if (scheduler == null) {
        handler = new RetryWithDelayHandler(maxAttempts, delay, filter, doOnRetryAction);
      } else {
        handler = new RetryWithDelayHandler(maxAttempts, delay, filter, doOnRetryAction, scheduler);
      }
      return new RetryWhenFunction(handler);
    }
docs: Construct the resulting {@link RetryWhenFunction}