src/main/java/org/michailov/async/WhenReady.java
public static <S, R> CompletableFuture<R> completeAsync(Predicate<S> ready, R result, S state, AsyncOptions asyncOptions) {
        Util.ensureArgumentNotNull("ready", ready);
        Util.ensureArgumentNotNull("asyncOptions", asyncOptions);

        CompletableFuture<R> future = new CompletableFuture<R>();
        WhenReadyArguments<S, R> args = new WhenReadyArguments<S, R>(ready, result, state, asyncOptions);
        return completeAsync(future, args);
    }
/**
     * Returns a future that gets completed with a value of <i>result</i> when the <i>ready</i> predicate returns true.
     * 
     * @param <S>           Type of <i>state</i> passed in to <i>ready</i>.
     * @param <R>           Type of <i>result</i> set on the future upon completion.
     * @param ready         A predicate that should return true when a given sync API is ready to be consumed without blocking.
     * @param result        The value that should be set on the future upon completion.
     * @param state         State that is passed to the predicate in order for it to make the right decision. May be null. 
     * @param asyncOptions  {@link AsyncOptions} that control this async call. 
     * @return              A future that will get completed with a value of <i>result</i> when the <i>ready</i> predicate returns true.
     */
Returns a future that gets completed with a value of result when the ready predicate returns true.

@param            Type of state passed in to ready.
@param            Type of result set on the future upon completion.
@param ready         A predicate that should return true when a given sync API is ready to be consumed without blocking.
@param result        The value that should be set on the future upon completion.
@param state         State that is passed to the predicate in order for it to make the right decision. May be null.
@param asyncOptions   AsyncOptions that control this async call.
@return              A future that will get completed with a value of result when the ready predicate returns true.
Returns a future that gets completed with a value of result when the ready predicate returns true . @param Type of state passed in to ready . @param Type of result set on the future upon completion . @param ready A predicate that should return true when a given sync API is ready to be consumed without blocking . @param result The value that should be set on the future upon completion . @param state State that is passed to the predicate in order for it to make the right decision . May be null . @param asyncOptions AsyncOptions that control this async call . @return A future that will get completed with a value of result when the ready predicate returns true .
public static <S, R> CompletableFuture<R> completeAsync(Predicate<S> ready, R result, S state, AsyncOptions asyncOptions) {
        Util.ensureArgumentNotNull("ready", ready);
        Util.ensureArgumentNotNull("asyncOptions", asyncOptions);
        CompletableFuture<R> future = new CompletableFuture<R>();
        WhenReadyArguments<S, R> args = new WhenReadyArguments<S, R>(ready, result, state, asyncOptions);
        return completeAsync(future, args);
    }
public static < S , R > CompletableFuture < R > completeAsync ( Predicate < S > ready , R result , S state , AsyncOptions asyncOptions ) { Util . ensureArgumentNotNull ( "ready" , ready ) ; Util . ensureArgumentNotNull ( "asyncOptions" , asyncOptions ) ; CompletableFuture < R > future = new CompletableFuture < R > ( ) ; WhenReadyArguments < S , R > args = new WhenReadyArguments < S , R > ( ready , result , state , asyncOptions ) ; return completeAsync ( future , args ) ; }
Returns a future that gets completed with a value of <i>result</i> when the <i>ready</i> predicate returns true.
Returns a future that gets completed with a value of <i > result< / i > when the <i > ready< / i > predicate returns true .