# CompletionStage

public interface **CompletionStage**

|---|---|---|
| Known Indirect Subclasses [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<T\> |---|---| | [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<T\> | A `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html` that may be explicitly completed (setting its value and status), and may be used as a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html`, supporting dependent functions and actions that trigger upon its completion. | |||

A stage of a possibly asynchronous computation, that performs an
action or computes a value when another CompletionStage completes.
A stage completes upon termination of its computation, but this may
in turn trigger other dependent stages. The functionality defined
in this interface takes only a few basic forms, which expand out to
a larger set of methods to capture a range of usage styles:

- The computation performed by a stage may be expressed as a Function, Consumer, or Runnable (using methods with names including *apply* , *accept* , or *run* , respectively) depending on whether it requires arguments and/or produces results. For example:

       stage.thenApply(x -> square(x))
            .thenAccept(x -> System.out.print(x))
            .thenRun(() -> System.out.println());

  An additional form (*compose* ) allows the construction of computation pipelines from functions returning completion stages.

  Any argument to a stage's computation is the outcome of a
  triggering stage's computation.

- One stage's execution may be triggered by completion of a single stage, or both of two stages, or either of two stages. Dependencies on a single stage are arranged using methods with prefix *then* . Those triggered by completion of *both* of two stages may *combine* their results or effects, using correspondingly named methods. Those triggered by *either* of two stages make no guarantees about which of the results or effects are used for the dependent stage's computation.
- Dependencies among stages control the triggering of computations, but do not otherwise guarantee any particular ordering. Additionally, execution of a new stage's computations may be arranged in any of three ways: default execution, default asynchronous execution (using methods with suffix *async* that employ the stage's default asynchronous execution facility), or custom (via a supplied `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html`). The execution properties of default and async modes are specified by CompletionStage implementations, not this interface. Methods with explicit Executor arguments may have arbitrary execution properties, and might not even support concurrent execution, but are arranged for processing in a way that accommodates asynchrony.
- Two method forms (`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#handle(java.util.function.BiFunction<?%20super%20T,%20java.lang.Throwable,%20?%20extends%20U>)` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#whenComplete(java.util.function.BiConsumer<?%20super%20T,%20?%20super%20java.lang.Throwable>)`) support unconditional computation whether the triggering stage completed normally or exceptionally. Method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#exceptionally(java.util.function.Function<java.lang.Throwable,%20?%20extends%20T>)` supports computation only when the triggering stage completes exceptionally, computing a replacement result, similarly to the java `catch` keyword. In all other cases, if a stage's computation terminates abruptly with an (unchecked) exception or error, then all dependent stages requiring its completion complete exceptionally as well, with a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionException.html` holding the exception as its cause. If a stage is dependent on *both* of two stages, and both complete exceptionally, then the CompletionException may correspond to either one of these exceptions. If a stage is dependent on *either* of two others, and only one of them completes exceptionally, no guarantees are made about whether the dependent stage completes normally or exceptionally. In the case of method `whenComplete`, when the supplied action itself encounters an exception, then the stage completes exceptionally with this exception unless the source stage also completed exceptionally, in which case the exceptional completion from the source stage is given preference and propagated to the dependent stage.

All methods adhere to the above triggering, execution, and
exceptional completion specifications (which are not repeated in
individual method specifications). Additionally, while arguments
used to pass a completion result (that is, for parameters of type
`T`) for methods accepting them may be null, passing a null
value for any other parameter will result in a `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html` being thrown.

Method form `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#handle(java.util.function.BiFunction<?%20super%20T,%20java.lang.Throwable,%20?%20extends%20U>)` is the most general way of
creating a continuation stage, unconditionally performing a
computation that is given both the result and exception (if any) of
the triggering CompletionStage, and computing an arbitrary result.
Method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#whenComplete(java.util.function.BiConsumer<?%20super%20T,%20?%20super%20java.lang.Throwable>)` is similar, but preserves
the result of the triggering stage instead of computing a new one.
Because a stage's normal result may be `null`, both methods
should have a computation structured thus:

    (result, exception) -> {
       if (exception == null) {
         // triggering stage completed normally
       } else {
         // triggering stage completed exceptionally
       }
     }

This interface does not define methods for initially creating,
forcibly completing normally or exceptionally, probing completion
status or results, or awaiting completion of a stage.
Implementations of CompletionStage may provide means of achieving
such effects, as appropriate. Method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#toCompletableFuture()`
enables interoperability among different implementations of this
interface by providing a common conversion type.

### Public Method Summary

|---|---|
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [acceptEither](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#acceptEither(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Consumer<?%20super%20T>))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action) Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied action. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [acceptEitherAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#acceptEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Consumer<?%20super%20T>,%20java.util.concurrent.Executor))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied action. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [acceptEitherAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#acceptEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Consumer<?%20super%20T>))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action) Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied action. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [applyToEither](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#applyToEither(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Function<?%20super%20T,%20U>))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, U\> fn) Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied function. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [applyToEitherAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#applyToEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Function<?%20super%20T,%20U>,%20java.util.concurrent.Executor))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, U\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied function. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [applyToEitherAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#applyToEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Function<?%20super%20T,%20U>))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, U\> fn) Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied function. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<T\> | [exceptionally](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#exceptionally(java.util.function.Function<java.lang.Throwable,%20?%20extends%20T>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<[Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html), ? extends T\> fn) Returns a new CompletionStage that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [handle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#handle(java.util.function.BiFunction<?%20super%20T,%20java.lang.Throwable,%20?%20extends%20U>))([BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html), ? extends U\> fn) Returns a new CompletionStage that, when this stage completes either normally or exceptionally, is executed with this stage's result and exception as arguments to the supplied function. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [handleAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#handleAsync(java.util.function.BiFunction<?%20super%20T,%20java.lang.Throwable,%20?%20extends%20U>,%20java.util.concurrent.Executor))([BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html), ? extends U\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when this stage completes either normally or exceptionally, is executed using the supplied executor, with this stage's result and exception as arguments to the supplied function. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [handleAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#handleAsync(java.util.function.BiFunction<?%20super%20T,%20java.lang.Throwable,%20?%20extends%20U>))([BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html), ? extends U\> fn) Returns a new CompletionStage that, when this stage completes either normally or exceptionally, is executed using this stage's default asynchronous execution facility, with this stage's result and exception as arguments to the supplied function. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [runAfterBoth](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#runAfterBoth(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action) Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [runAfterBothAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#runAfterBothAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action) Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action using this stage's default asynchronous execution facility. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [runAfterBothAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#runAfterBothAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable,%20java.util.concurrent.Executor))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action using the supplied executor. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [runAfterEither](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#runAfterEither(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action) Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [runAfterEitherAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#runAfterEitherAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action) Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action using this stage's default asynchronous execution facility. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [runAfterEitherAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#runAfterEitherAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable,%20java.util.concurrent.Executor))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action using the supplied executor. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [thenAccept](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenAccept(java.util.function.Consumer<?%20super%20T>))([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action) Returns a new CompletionStage that, when this stage completes normally, is executed with this stage's result as the argument to the supplied action. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [thenAcceptAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenAcceptAsync(java.util.function.Consumer<?%20super%20T>,%20java.util.concurrent.Executor))([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when this stage completes normally, is executed using the supplied Executor, with this stage's result as the argument to the supplied action. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [thenAcceptAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenAcceptAsync(java.util.function.Consumer<?%20super%20T>))([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action) Returns a new CompletionStage that, when this stage completes normally, is executed using this stage's default asynchronous execution facility, with this stage's result as the argument to the supplied action. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [thenAcceptBoth](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenAcceptBoth(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiConsumer<?%20super%20T,%20?%20super%20U>))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super U\> action) Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied action. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [thenAcceptBothAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenAcceptBothAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiConsumer<?%20super%20T,%20?%20super%20U>,%20java.util.concurrent.Executor))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super U\> action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [thenAcceptBothAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenAcceptBothAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiConsumer<?%20super%20T,%20?%20super%20U>))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super U\> action) Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed using this stage's default asynchronous execution facility, with the two results as arguments to the supplied action. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [thenApply](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenApply(java.util.function.Function<?%20super%20T,%20?%20extends%20U>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> fn) Returns a new CompletionStage that, when this stage completes normally, is executed with this stage's result as the argument to the supplied function. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [thenApplyAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenApplyAsync(java.util.function.Function<?%20super%20T,%20?%20extends%20U>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> fn) Returns a new CompletionStage that, when this stage completes normally, is executed using this stage's default asynchronous execution facility, with this stage's result as the argument to the supplied function. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [thenApplyAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenApplyAsync(java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.concurrent.Executor))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when this stage completes normally, is executed using the supplied Executor, with this stage's result as the argument to the supplied function. |
| abstract \<U, V\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<V\> | [thenCombine](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenCombine(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiFunction<?%20super%20T,%20?%20super%20U,%20?%20extends%20V>))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, ? super U, ? extends V\> fn) Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied function. |
| abstract \<U, V\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<V\> | [thenCombineAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenCombineAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiFunction<?%20super%20T,%20?%20super%20U,%20?%20extends%20V>))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, ? super U, ? extends V\> fn) Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed using this stage's default asynchronous execution facility, with the two results as arguments to the supplied function. |
| abstract \<U, V\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<V\> | [thenCombineAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenCombineAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiFunction<?%20super%20T,%20?%20super%20U,%20?%20extends%20V>,%20java.util.concurrent.Executor))([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, ? super U, ? extends V\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [thenCompose](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenCompose(java.util.function.Function<?%20super%20T,%20?%20extends%20java.util.concurrent.CompletionStage<U>>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>\> fn) Returns a new CompletionStage that is completed with the same value as the CompletionStage returned by the given function. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [thenComposeAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenComposeAsync(java.util.function.Function<?%20super%20T,%20?%20extends%20java.util.concurrent.CompletionStage<U>>,%20java.util.concurrent.Executor))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that is completed with the same value as the CompletionStage returned by the given function, executed using the supplied Executor. |
| abstract \<U\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\> | [thenComposeAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenComposeAsync(java.util.function.Function<?%20super%20T,%20?%20extends%20java.util.concurrent.CompletionStage<U>>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>\> fn) Returns a new CompletionStage that is completed with the same value as the CompletionStage returned by the given function, executed using this stage's default asynchronous execution facility. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [thenRun](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenRun(java.lang.Runnable))([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action) Returns a new CompletionStage that, when this stage completes normally, executes the given action. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [thenRunAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenRunAsync(java.lang.Runnable,%20java.util.concurrent.Executor))([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage that, when this stage completes normally, executes the given action using the supplied Executor. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [thenRunAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#thenRunAsync(java.lang.Runnable))([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action) Returns a new CompletionStage that, when this stage completes normally, executes the given action using this stage's default asynchronous execution facility. |
| abstract [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<T\> | [toCompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#toCompletableFuture())() Returns a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html` maintaining the same completion properties as this stage. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<T\> | [whenComplete](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#whenComplete(java.util.function.BiConsumer<?%20super%20T,%20?%20super%20java.lang.Throwable>))([BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)\> action) Returns a new CompletionStage with the same result or exception as this stage, that executes the given action when this stage completes. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<T\> | [whenCompleteAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#whenCompleteAsync(java.util.function.BiConsumer<?%20super%20T,%20?%20super%20java.lang.Throwable>))([BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)\> action) Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using this stage's default asynchronous execution facility when this stage completes. |
| abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<T\> | [whenCompleteAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#whenCompleteAsync(java.util.function.BiConsumer<?%20super%20T,%20?%20super%20java.lang.Throwable>,%20java.util.concurrent.Executor))([BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)\> action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using the supplied Executor when this stage completes. |

## Public Methods

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**acceptEither**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action)

Returns a new CompletionStage that, when either this or the
other given stage complete normally, is executed with the
corresponding result as argument to the supplied action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**acceptEitherAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when either this or the
other given stage complete normally, is executed using the
supplied executor, with the corresponding result as argument to
the supplied action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**acceptEitherAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action)

Returns a new CompletionStage that, when either this or the
other given stage complete normally, is executed using this
stage's default asynchronous execution facility, with the
corresponding result as argument to the supplied action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**applyToEither**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, U\> fn)

Returns a new CompletionStage that, when either this or the
other given stage complete normally, is executed with the
corresponding result as argument to the supplied function.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| fn | the function to use to compute the value of the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**applyToEitherAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, U\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when either this or the
other given stage complete normally, is executed using the
supplied executor, with the corresponding result as argument to
the supplied function.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| fn | the function to use to compute the value of the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**applyToEitherAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends T\> other, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, U\> fn)

Returns a new CompletionStage that, when either this or the
other given stage complete normally, is executed using this
stage's default asynchronous execution facility, with the
corresponding result as argument to the supplied function.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| fn | the function to use to compute the value of the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<T\>
**exceptionally**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<[Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html), ? extends T\> fn)

Returns a new CompletionStage that, when this stage completes
exceptionally, is executed with this stage's exception as the
argument to the supplied function. Otherwise, if this stage
completes normally, then the returned stage also completes
normally with the same value.

##### Parameters

| fn | the function to use to compute the value of the returned CompletionStage if this CompletionStage completed exceptionally |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**handle**
([BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html), ? extends U\> fn)

Returns a new CompletionStage that, when this stage completes
either normally or exceptionally, is executed with this stage's
result and exception as arguments to the supplied function.

When this stage is complete, the given function is invoked
with the result (or `null` if none) and the exception (or
`null` if none) of this stage as arguments, and the
function's result is used to complete the returned stage.

##### Parameters

| fn | the function to use to compute the value of the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**handleAsync**
([BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html), ? extends U\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when this stage completes
either normally or exceptionally, is executed using the
supplied executor, with this stage's result and exception as
arguments to the supplied function.

When this stage is complete, the given function is invoked
with the result (or `null` if none) and the exception (or
`null` if none) of this stage as arguments, and the
function's result is used to complete the returned stage.

##### Parameters

| fn | the function to use to compute the value of the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**handleAsync**
([BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html), ? extends U\> fn)

Returns a new CompletionStage that, when this stage completes
either normally or exceptionally, is executed using this stage's
default asynchronous execution facility, with this stage's
result and exception as arguments to the supplied function.

When this stage is complete, the given function is invoked
with the result (or `null` if none) and the exception (or
`null` if none) of this stage as arguments, and the
function's result is used to complete the returned stage.

##### Parameters

| fn | the function to use to compute the value of the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**runAfterBoth**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action)

Returns a new CompletionStage that, when this and the other
given stage both complete normally, executes the given action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**runAfterBothAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action)

Returns a new CompletionStage that, when this and the other
given stage both complete normally, executes the given action
using this stage's default asynchronous execution facility.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**runAfterBothAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when this and the other
given stage both complete normally, executes the given action
using the supplied executor.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**runAfterEither**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action)

Returns a new CompletionStage that, when either this or the
other given stage complete normally, executes the given action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**runAfterEitherAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action)

Returns a new CompletionStage that, when either this or the
other given stage complete normally, executes the given action
using this stage's default asynchronous execution facility.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**runAfterEitherAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<?\> other, [Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when either this or the
other given stage complete normally, executes the given action
using the supplied executor.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**thenAccept**
([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action)

Returns a new CompletionStage that, when this stage completes
normally, is executed with this stage's result as the argument
to the supplied action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**thenAcceptAsync**
([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when this stage completes
normally, is executed using the supplied Executor, with this
stage's result as the argument to the supplied action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| action | the action to perform before completing the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**thenAcceptAsync**
([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action)

Returns a new CompletionStage that, when this stage completes
normally, is executed using this stage's default asynchronous
execution facility, with this stage's result as the argument to
the supplied action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**thenAcceptBoth**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super U\> action)

Returns a new CompletionStage that, when this and the other
given stage both complete normally, is executed with the two
results as arguments to the supplied action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**thenAcceptBothAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super U\> action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when this and the other
given stage both complete normally, is executed using the
supplied executor, with the two results as arguments to the
supplied action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**thenAcceptBothAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super U\> action)

Returns a new CompletionStage that, when this and the other
given stage both complete normally, is executed using this
stage's default asynchronous execution facility, with the two
results as arguments to the supplied action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**thenApply**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> fn)

Returns a new CompletionStage that, when this stage completes
normally, is executed with this stage's result as the argument
to the supplied function.

This method is analogous to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Optional.html#map(java.util.function.Function<?%20super%20T,%20?%20extends%20U>)` and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html#map(java.util.function.Function<?%20super%20T,%20?%20extends%20R>)`.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| fn | the function to use to compute the value of the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**thenApplyAsync**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> fn)

Returns a new CompletionStage that, when this stage completes
normally, is executed using this stage's default asynchronous
execution facility, with this stage's result as the argument to
the supplied function.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| fn | the function to use to compute the value of the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**thenApplyAsync**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when this stage completes
normally, is executed using the supplied Executor, with this
stage's result as the argument to the supplied function.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| fn | the function to use to compute the value of the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<V\>
**thenCombine**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, ? super U, ? extends V\> fn)

Returns a new CompletionStage that, when this and the other
given stage both complete normally, is executed with the two
results as arguments to the supplied function.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| fn | the function to use to compute the value of the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<V\>
**thenCombineAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, ? super U, ? extends V\> fn)

Returns a new CompletionStage that, when this and the other
given stage both complete normally, is executed using this
stage's default asynchronous execution facility, with the two
results as arguments to the supplied function.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| fn | the function to use to compute the value of the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<V\>
**thenCombineAsync**
([CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<? extends U\> other, [BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<? super T, ? super U, ? extends V\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when this and the other
given stage both complete normally, is executed using the
supplied executor, with the two results as arguments to the
supplied function.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| other | the other CompletionStage |
| fn | the function to use to compute the value of the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**thenCompose**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>\> fn)

Returns a new CompletionStage that is completed with the same
value as the CompletionStage returned by the given function.

When this stage completes normally, the given function is
invoked with this stage's result as the argument, returning
another CompletionStage. When that stage completes normally,
the CompletionStage returned by this method is completed with
the same value.

To ensure progress, the supplied function must arrange
eventual completion of its result.

This method is analogous to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Optional.html#flatMap(java.util.function.Function<?%20super%20T,%20java.util.Optional<U>>)` and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html#flatMap(java.util.function.Function<?%20super%20T,%20?%20extends%20java.util.stream.Stream<?%20extends%20R>>)`.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| fn | the function to use to compute another CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**thenComposeAsync**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>\> fn, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that is completed with the same
value as the CompletionStage returned by the given function,
executed using the supplied Executor.

When this stage completes normally, the given function is
invoked with this stage's result as the argument, returning
another CompletionStage. When that stage completes normally,
the CompletionStage returned by this method is completed with
the same value.

To ensure progress, the supplied function must arrange
eventual completion of its result.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| fn | the function to use to compute another CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>
**thenComposeAsync**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<U\>\> fn)

Returns a new CompletionStage that is completed with the same
value as the CompletionStage returned by the given function,
executed using this stage's default asynchronous execution
facility.

When this stage completes normally, the given function is
invoked with this stage's result as the argument, returning
another CompletionStage. When that stage completes normally,
the CompletionStage returned by this method is completed with
the same value.

To ensure progress, the supplied function must arrange
eventual completion of its result.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| fn | the function to use to compute another CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**thenRun**
([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action)

Returns a new CompletionStage that, when this stage completes
normally, executes the given action.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**thenRunAsync**
([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage that, when this stage completes
normally, executes the given action using the supplied Executor.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| action | the action to perform before completing the returned CompletionStage |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**thenRunAsync**
([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) action)

Returns a new CompletionStage that, when this stage completes
normally, executes the given action using this stage's default
asynchronous execution facility.

See the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` documentation for rules
covering exceptional completion.

##### Parameters

| action | the action to perform before completing the returned CompletionStage |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<T\>
**toCompletableFuture**
()

Returns a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html` maintaining the same
completion properties as this stage. If this stage is already a
CompletableFuture, this method may return this stage itself.
Otherwise, invocation of this method may be equivalent in
effect to `thenApply(x -> x)`, but returning an instance
of type `CompletableFuture`. A CompletionStage
implementation that does not choose to interoperate with others
may throw `UnsupportedOperationException`.

##### Returns

- the CompletableFuture

##### Throws

| [UnsupportedOperationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/UnsupportedOperationException.html) | if this implementation does not interoperate with CompletableFuture |
|---|---|

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<T\>
**whenComplete**
([BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)\> action)

Returns a new CompletionStage with the same result or exception as
this stage, that executes the given action when this stage completes.

When this stage is complete, the given action is invoked
with the result (or `null` if none) and the exception (or
`null` if none) of this stage as arguments. The returned
stage is completed when the action returns.

Unlike method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#handle(java.util.function.BiFunction<?%20super%20T,%20java.lang.Throwable,%20?%20extends%20U>)`,
this method is not designed to translate completion outcomes,
so the supplied action should not throw an exception. However,
if it does, the following rules apply: if this stage completed
normally but the supplied action throws an exception, then the
returned stage completes exceptionally with the supplied
action's exception. Or, if this stage completed exceptionally
and the supplied action throws an exception, then the returned
stage completes exceptionally with this stage's exception.

##### Parameters

| action | the action to perform |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<T\>
**whenCompleteAsync**
([BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)\> action)

Returns a new CompletionStage with the same result or exception as
this stage, that executes the given action using this stage's
default asynchronous execution facility when this stage completes.

When this stage is complete, the given action is invoked with the
result (or `null` if none) and the exception (or `null`
if none) of this stage as arguments. The returned stage is completed
when the action returns.

Unlike method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#handleAsync(java.util.function.BiFunction<?%20super%20T,%20java.lang.Throwable,%20?%20extends%20U>)`,
this method is not designed to translate completion outcomes,
so the supplied action should not throw an exception. However,
if it does, the following rules apply: If this stage completed
normally but the supplied action throws an exception, then the
returned stage completes exceptionally with the supplied
action's exception. Or, if this stage completed exceptionally
and the supplied action throws an exception, then the returned
stage completes exceptionally with this stage's exception.

##### Parameters

| action | the action to perform |
|---|---|

##### Returns

- the new CompletionStage

#### public abstract [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)\<T\>
**whenCompleteAsync**
([BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<? super T, ? super [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)\> action, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletionStage with the same result or exception as
this stage, that executes the given action using the supplied
Executor when this stage completes.

When this stage is complete, the given action is invoked with the
result (or `null` if none) and the exception (or `null`
if none) of this stage as arguments. The returned stage is completed
when the action returns.

Unlike method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html#handleAsync(java.util.function.BiFunction<?%20super%20T,%20java.lang.Throwable,%20?%20extends%20U>,%20java.util.concurrent.Executor)`,
this method is not designed to translate completion outcomes,
so the supplied action should not throw an exception. However,
if it does, the following rules apply: If this stage completed
normally but the supplied action throws an exception, then the
returned stage completes exceptionally with the supplied
action's exception. Or, if this stage completed exceptionally
and the supplied action throws an exception, then the returned
stage completes exceptionally with this stage's exception.

##### Parameters

| action | the action to perform |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletionStage