# CompletableFuture

public class **CompletableFuture** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Future](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html)\<T\> [CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.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.

When two or more threads attempt to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#complete(T)`,
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#completeExceptionally(java.lang.Throwable)`, or
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#cancel(boolean)`
a CompletableFuture, only one of them succeeds.

In addition to these and related methods for directly
manipulating status and results, CompletableFuture implements
interface `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html` with the following policies:

- Actions supplied for dependent completions of *non-async* methods may be performed by the thread that completes the current CompletableFuture, or by any other caller of a completion method.
- All *async* methods without an explicit Executor argument are performed using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ForkJoinPool.html#commonPool()` (unless it does not support a parallelism level of at least two, in which case, a new Thread is created to run each task). To simplify monitoring, debugging, and tracking, all generated asynchronous tasks are instances of the marker interface `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.AsynchronousCompletionTask.html`. Operations with time-delays can use adapter methods defined in this class, for example: `supplyAsync(supplier, delayedExecutor(timeout,
  timeUnit))`. To support methods with delays and timeouts, this class maintains at most one daemon thread for triggering and cancelling actions, not for running them.
- All CompletionStage methods are implemented independently of other public methods, so the behavior of one method is not impacted by overrides of others in subclasses.

CompletableFuture also implements `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html` with the following
policies:

- Since (unlike `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/FutureTask.html`) this class has no direct control over the computation that causes it to be completed, cancellation is treated as just another form of exceptional completion. Method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#cancel(boolean)` has the same effect as `completeExceptionally(new CancellationException())`. Method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#isCompletedExceptionally()` can be used to determine if a CompletableFuture completed in any exceptional fashion.
- In case of exceptional completion with a CompletionException, methods `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get()` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get(long,%20java.util.concurrent.TimeUnit)` throw an `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ExecutionException.html` with the same cause as held in the corresponding CompletionException. To simplify usage in most contexts, this class also defines methods `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#join()` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#getNow(T)` that instead throw the CompletionException directly in these cases.

Arguments used to pass a completion result (that is, for
parameters of type `T`) for methods accepting them may be
null, but 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.

### Nested Class Summary

|---|---|---|---|
| interface | [CompletableFuture.AsynchronousCompletionTask](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.AsynchronousCompletionTask.html) || A marker interface identifying asynchronous tasks produced by `async` methods. |

### Public Constructor Summary

|---|---|
|   | [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#CompletableFuture())() Creates a new incomplete CompletableFuture. |

### Public Method Summary

|---|---|
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [allOf](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#allOf(java.util.concurrent.CompletableFuture<?>...))([CompletableFuture...](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<?\> cfs) Returns a new CompletableFuture that is completed when all of the given CompletableFutures complete. |
| static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<[Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)\> | [anyOf](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#anyOf(java.util.concurrent.CompletableFuture<?>...))([CompletableFuture...](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<?\> cfs) Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [applyToEither](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [applyToEitherAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [applyToEitherAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| boolean | [cancel](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#cancel(boolean))(boolean mayInterruptIfRunning) If not already completed, completes this CompletableFuture with a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CancellationException.html`. |
| boolean | [complete](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#complete(T))(T value) If not already completed, sets the value returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get()` and related methods to the given value. |
| boolean | [completeExceptionally](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#completeExceptionally(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) ex) If not already completed, causes invocations of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get()` and related methods to throw the given exception. |
| static \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [completedFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#completedFuture(U))(U value) Returns a new CompletableFuture that is already completed with the given value. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<T\> | [exceptionally](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 CompletableFuture that is completed when this CompletableFuture completes, with the result of the given function of the exception triggering this CompletableFuture's completion when it completes exceptionally; otherwise, if this CompletableFuture completes normally, then the returned CompletableFuture also completes normally with the same value. |
| T | [get](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get(long,%20java.util.concurrent.TimeUnit))(long timeout, [TimeUnit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/TimeUnit.html) unit) Waits if necessary for at most the given time for this future to complete, and then returns its result, if available. |
| T | [get](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get())() Waits if necessary for this future to complete, and then returns its result. |
| T | [getNow](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#getNow(T))(T valueIfAbsent) Returns the result value (or throws any encountered exception) if completed, else returns the given valueIfAbsent. |
| int | [getNumberOfDependents](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#getNumberOfDependents())() Returns the estimated number of CompletableFutures whose completions are awaiting completion of this CompletableFuture. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [handle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [handleAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [handleAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| boolean | [isCancelled](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#isCancelled())() Returns `true` if this CompletableFuture was cancelled before it completed normally. |
| boolean | [isCompletedExceptionally](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#isCompletedExceptionally())() Returns `true` if this CompletableFuture completed exceptionally, in any way. |
| boolean | [isDone](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#isDone())() Returns `true` if completed in any fashion: normally, exceptionally, or via cancellation. |
| T | [join](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#join())() Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally. |
| void | [obtrudeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#obtrudeException(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) ex) Forcibly causes subsequent invocations of method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get()` and related methods to throw the given exception, whether or not already completed. |
| void | [obtrudeValue](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#obtrudeValue(T))(T value) Forcibly sets or resets the value subsequently returned by method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get()` and related methods, whether or not already completed. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [runAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#runAsync(java.lang.Runnable))([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) runnable) Returns a new CompletableFuture that is asynchronously completed by a task running in the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ForkJoinPool.html#commonPool()` after it runs the given action. |
| static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\> | [runAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#runAsync(java.lang.Runnable,%20java.util.concurrent.Executor))([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) runnable, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor after it runs the given action. |
| static \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [supplyAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#supplyAsync(java.util.function.Supplier<U>))([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<U\> supplier) Returns a new CompletableFuture that is asynchronously completed by a task running in the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ForkJoinPool.html#commonPool()` with the value obtained by calling the given Supplier. |
| static \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [supplyAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#supplyAsync(java.util.function.Supplier<U>,%20java.util.concurrent.Executor))([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<U\> supplier, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor) Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [thenApply](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [thenApplyAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [thenApplyAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U, V\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<V\> | [thenCombine](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U, V\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<V\> | [thenCombineAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U, V\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<V\> | [thenCombineAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [thenCompose](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [thenComposeAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| \<U\> [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\> | [thenComposeAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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/CompletableFuture.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. |
| [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/CompletableFuture.html#toCompletableFuture())() Returns this CompletableFuture. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#toString())() Returns a string identifying this CompletableFuture, as well as its completion state. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<T\> | [whenComplete](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<T\> | [whenCompleteAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |
| [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<T\> | [whenCompleteAsync](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.util.concurrent.Future](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html)

|---|---|
| abstract boolean | [cancel](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html#cancel(boolean))(boolean mayInterruptIfRunning) Attempts to cancel execution of this task. |
| abstract T | [get](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html#get(long,%20java.util.concurrent.TimeUnit))(long timeout, [TimeUnit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/TimeUnit.html) unit) Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available. |
| abstract T | [get](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html#get())() Waits if necessary for the computation to complete, and then retrieves its result. |
| abstract boolean | [isCancelled](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html#isCancelled())() Returns `true` if this task was cancelled before it completed normally. |
| abstract boolean | [isDone](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html#isDone())() Returns `true` if this task completed. |

From interface [java.util.concurrent.CompletionStage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionStage.html)

|---|---|
| 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 Constructors

#### public
**CompletableFuture**
()

Creates a new incomplete CompletableFuture.

## Public Methods

#### public [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**allOf**
([CompletableFuture...](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<?\> cfs)

Returns a new CompletableFuture that is completed when all of
the given CompletableFutures complete. If any of the given
CompletableFutures complete exceptionally, then the returned
CompletableFuture also does so, with a CompletionException
holding this exception as its cause. Otherwise, the results,
if any, of the given CompletableFutures are not reflected in
the returned CompletableFuture, but may be obtained by
inspecting them individually. If no CompletableFutures are
provided, returns a CompletableFuture completed with the value
`null`.

Among the applications of this method is to await completion
of a set of independent CompletableFutures before continuing a
program, as in: `CompletableFuture.allOf(c1, c2,
c3).join();`.

##### Parameters

| cfs | the CompletableFutures |
|---|---|

##### Returns

- a new CompletableFuture that is completed when all of the given CompletableFutures complete

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if the array or any of its elements are `null` |
|---|---|

#### public static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<[Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)\>
**anyOf**
([CompletableFuture...](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<?\> cfs)

Returns a new CompletableFuture that is completed when any of
the given CompletableFutures complete, with the same result.
Otherwise, if it completed exceptionally, the returned
CompletableFuture also does so, with a CompletionException
holding this exception as its cause. If no CompletableFutures
are provided, returns an incomplete CompletableFuture.

##### Parameters

| cfs | the CompletableFutures |
|---|---|

##### Returns

- a new CompletableFuture that is completed with the result or exception of any of the given CompletableFutures when one completes

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if the array or any of its elements are `null` |
|---|---|

#### public [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 boolean
**cancel**
(boolean mayInterruptIfRunning)

If not already completed, completes this CompletableFuture with
a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CancellationException.html`. Dependent CompletableFutures
that have not already completed will also complete
exceptionally, with a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionException.html` caused by
this `CancellationException`.

##### Parameters

| mayInterruptIfRunning | this value has no effect in this implementation because interrupts are not used to control processing. |
|---|---|

##### Returns

- `true` if this task is now cancelled

#### public boolean
**complete**
(T value)

If not already completed, sets the value returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get()` and related methods to the given value.

##### Parameters

| value | the result value |
|---|---|

##### Returns

- `true` if this invocation caused this CompletableFuture to transition to a completed state, else `false`

#### public boolean
**completeExceptionally**
([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) ex)

If not already completed, causes invocations of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get()`
and related methods to throw the given exception.

##### Parameters

| ex | the exception |
|---|---|

##### Returns

- `true` if this invocation caused this CompletableFuture to transition to a completed state, else `false`

#### public static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\>
**completedFuture**
(U value)

Returns a new CompletableFuture that is already completed with
the given value.

##### Parameters

| value | the value |
|---|---|

##### Returns

- the completed CompletableFuture

#### public [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 CompletableFuture that is completed when this
CompletableFuture completes, with the result of the given
function of the exception triggering this CompletableFuture's
completion when it completes exceptionally; otherwise, if this
CompletableFuture completes normally, then the returned
CompletableFuture also completes normally with the same value.
Note: More flexible versions of this functionality are
available using methods `whenComplete` and `handle`.

##### Parameters

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

##### Returns

- the new CompletableFuture

#### public T
**get**
(long timeout, [TimeUnit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/TimeUnit.html) unit)

Waits if necessary for at most the given time for this future
to complete, and then returns its result, if available.

##### Parameters

| timeout | the maximum time to wait |
| unit | the time unit of the timeout argument |
|---|---|

##### Returns

- the result value

##### Throws

| [CancellationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CancellationException.html) | if this future was cancelled |
| [ExecutionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ExecutionException.html) | if this future completed exceptionally |
| [InterruptedException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/InterruptedException.html) | if the current thread was interrupted while waiting |
| [TimeoutException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/TimeoutException.html) | if the wait timed out |
|---|---|

#### public T
**get**
()

Waits if necessary for this future to complete, and then
returns its result.

##### Returns

- the result value

##### Throws

| [CancellationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CancellationException.html) | if this future was cancelled |
| [ExecutionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ExecutionException.html) | if this future completed exceptionally |
| [InterruptedException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/InterruptedException.html) | if the current thread was interrupted while waiting |
|---|---|

#### public T
**getNow**
(T valueIfAbsent)

Returns the result value (or throws any encountered exception)
if completed, else returns the given valueIfAbsent.

##### Parameters

| valueIfAbsent | the value to return if not completed |
|---|---|

##### Returns

- the result value, if completed, else the given valueIfAbsent

##### Throws

| [CancellationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CancellationException.html) | if the computation was cancelled |
| [CompletionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionException.html) | if this future completed exceptionally or a completion computation threw an exception |
|---|---|

#### public int
**getNumberOfDependents**
()

Returns the estimated number of CompletableFutures whose
completions are awaiting completion of this CompletableFuture.
This method is designed for use in monitoring system state, not
for synchronization control.

##### Returns

- the number of dependent CompletableFutures

#### public [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 boolean
**isCancelled**
()

Returns `true` if this CompletableFuture was cancelled
before it completed normally.

##### Returns

- `true` if this CompletableFuture was cancelled before it completed normally

#### public boolean
**isCompletedExceptionally**
()

Returns `true` if this CompletableFuture completed
exceptionally, in any way. Possible causes include
cancellation, explicit invocation of `completeExceptionally`, and abrupt termination of a
CompletionStage action.

##### Returns

- `true` if this CompletableFuture completed exceptionally

#### public boolean
**isDone**
()

Returns `true` if completed in any fashion: normally,
exceptionally, or via cancellation.

##### Returns

- `true` if completed

#### public T
**join**
()

Returns the result value when complete, or throws an
(unchecked) exception if completed exceptionally. To better
conform with the use of common functional forms, if a
computation involved in the completion of this
CompletableFuture threw an exception, this method throws an
(unchecked) `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionException.html` with the underlying
exception as its cause.

##### Returns

- the result value

##### Throws

| [CancellationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CancellationException.html) | if the computation was cancelled |
| [CompletionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletionException.html) | if this future completed exceptionally or a completion computation threw an exception |
|---|---|

#### public void
**obtrudeException**
([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) ex)

Forcibly causes subsequent invocations of method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get()`
and related methods to throw the given exception, whether or
not already completed. This method is designed for use only in
error recovery actions, and even in such situations may result
in ongoing dependent completions using established versus
overwritten outcomes.

##### Parameters

| ex | the exception |
|---|---|

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if the exception is null |
|---|---|

#### public void
**obtrudeValue**
(T value)

Forcibly sets or resets the value subsequently returned by
method `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html#get()` and related methods, whether or not
already completed. This method is designed for use only in
error recovery actions, and even in such situations may result
in ongoing dependent completions using established versus
overwritten outcomes.

##### Parameters

| value | the completion value |
|---|---|

#### public [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**runAsync**
([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) runnable)

Returns a new CompletableFuture that is asynchronously completed
by a task running in the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ForkJoinPool.html#commonPool()` after
it runs the given action.

##### Parameters

| runnable | the action to run before completing the returned CompletableFuture |
|---|---|

##### Returns

- the new CompletableFuture

#### public static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<[Void](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Void.html)\>
**runAsync**
([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) runnable, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletableFuture that is asynchronously completed
by a task running in the given executor after it runs the given
action.

##### Parameters

| runnable | the action to run before completing the returned CompletableFuture |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletableFuture

#### public static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\>
**supplyAsync**
([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<U\> supplier)

Returns a new CompletableFuture that is asynchronously completed
by a task running in the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ForkJoinPool.html#commonPool()` with
the value obtained by calling the given Supplier.

##### Parameters

| supplier | a function returning the value to be used to complete the returned CompletableFuture |
|---|---|

##### Returns

- the new CompletableFuture

#### public static [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.html)\<U\>
**supplyAsync**
([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<U\> supplier, [Executor](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Executor.html) executor)

Returns a new CompletableFuture that is asynchronously completed
by a task running in the given executor with the value obtained
by calling the given Supplier.

##### Parameters

| supplier | a function returning the value to be used to complete the returned CompletableFuture |
| executor | the executor to use for asynchronous execution |
|---|---|

##### Returns

- the new CompletableFuture

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

Returns this CompletableFuture.

##### Returns

- this CompletableFuture

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Returns a string identifying this CompletableFuture, as well as
its completion state. The state, in brackets, contains the
String `"Completed Normally"` or the String `"Completed Exceptionally"`, or the String `"Not
completed"` followed by the number of CompletableFutures
dependent upon its completion, if any.

##### Returns

- a string identifying this CompletableFuture, as well as its state

#### public [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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 [CompletableFuture](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/CompletableFuture.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