# CompletableFuture

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#nestedclasses)\|[Ctors](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#pubctors)\|[Methods](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#inhmethods)  

# CompletableFuture

`
public


class
CompletableFuture
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>,

`[Future](https://developer.android.com/reference/java/util/concurrent/Future)`<T>


`

|---|---------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.util.concurrent.CompletableFuture\<T\> |

<br />

*** ** * ** ***

A[Future](https://developer.android.com/reference/java/util/concurrent/Future)that may be explicitly completed (setting its value and status), and may be used as a[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage), supporting dependent functions and actions that trigger upon its completion.

When two or more threads attempt to[complete](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#complete(T)),[completeExceptionally](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#completeExceptionally(java.lang.Throwable)), or[cancel](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)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[ForkJoinPool.commonPool()](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool#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[AsynchronousCompletionTask](https://developer.android.com/reference/java/util/concurrent/CompletableFuture.AsynchronousCompletionTask). 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[Future](https://developer.android.com/reference/java/util/concurrent/Future)with the following policies:

- Since (unlike[FutureTask](https://developer.android.com/reference/java/util/concurrent/FutureTask)) 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[cancel](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#cancel(boolean))has the same effect as`completeExceptionally(new CancellationException())`. Method[isCompletedExceptionally()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#isCompletedExceptionally())can be used to determine if a CompletableFuture completed in any exceptional fashion.
- In case of exceptional completion with a CompletionException, methods[get()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#get())and[get(long, java.util.concurrent.TimeUnit)](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#get(long,%20java.util.concurrent.TimeUnit))throw an[ExecutionException](https://developer.android.com/reference/java/util/concurrent/ExecutionException)with the same cause as held in the corresponding CompletionException. To simplify usage in most contexts, this class also defines methods[join()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#join())and[getNow(T)](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#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[NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)being thrown.

## Summary

|                                                                                                                  ### Nested classes                                                                                                                  ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` interface` | [CompletableFuture.AsynchronousCompletionTask](https://developer.android.com/reference/java/util/concurrent/CompletableFuture.AsynchronousCompletionTask) A marker interface identifying asynchronous tasks produced by`async`methods. |

|                                                                            ### Public constructors                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#CompletableFuture())`() ` Creates a new incomplete CompletableFuture. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[acceptEither](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#acceptEither(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Consumer<?%20super%20T>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[acceptEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#acceptEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Consumer<?%20super%20T>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[acceptEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#acceptEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Consumer<?%20super%20T>,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super T> action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[allOf](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#allOf(java.util.concurrent.CompletableFuture<?>[]))`(`[CompletableFuture...](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<?> cfs) ` Returns a new CompletableFuture that is completed when all of the given CompletableFutures complete.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` static `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Object](https://developer.android.com/reference/java/lang/Object)`>` | ` `[anyOf](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#anyOf(java.util.concurrent.CompletableFuture<?>[]))`(`[CompletableFuture...](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<?> cfs) ` Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[applyToEither](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#applyToEither(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Function<?%20super%20T,U>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Function](https://developer.android.com/reference/java/util/function/Function)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[applyToEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#applyToEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Function<?%20super%20T,U>,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, U> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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.                                                              |
| ` <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[applyToEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#applyToEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Function<?%20super%20T,U>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Function](https://developer.android.com/reference/java/util/function/Function)`<? 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.                                                                                                                                                              |
| ` boolean`                                                                                                                                                                            | ` `[cancel](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#cancel(boolean))`(boolean mayInterruptIfRunning) ` If not already completed, completes this CompletableFuture with a[CancellationException](https://developer.android.com/reference/java/util/concurrent/CancellationException).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` boolean`                                                                                                                                                                            | ` `[complete](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#complete(T))`(T value) ` If not already completed, sets the value returned by[get()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#get())and related methods to the given value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[completeAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#completeAsync(java.util.function.Supplier<?%20extends%20T>,%20java.util.concurrent.Executor))`(`[Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<? extends T> supplier, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor) ` Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor.                                                                                                                                                                                                                                                                                                                    |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[completeAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#completeAsync(java.util.function.Supplier<?%20extends%20T>))`(`[Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<? extends T> supplier) ` Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor.                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` boolean`                                                                                                                                                                            | ` `[completeExceptionally](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#completeExceptionally(java.lang.Throwable))`(`[Throwable](https://developer.android.com/reference/java/lang/Throwable)` ex) ` If not already completed, causes invocations of[get()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#get())and related methods to throw the given exception.                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[completeOnTimeout](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#completeOnTimeout(T,%20long,%20java.util.concurrent.TimeUnit))`(T value, long timeout, `[TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)` unit) ` Completes this CompletableFuture with the given value if not otherwise completed before the given timeout.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` static <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                | ` `[completedFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#completedFuture(U))`(U value) ` Returns a new CompletableFuture that is already completed with the given value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` static <U> `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                    | ` `[completedStage](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#completedStage(U))`(U value) ` Returns a new CompletionStage that is already completed with the given value and supports only those methods in interface[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[copy](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#copy())`() ` Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)                                                                                                  | ` `[defaultExecutor](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#defaultExecutor())`() ` Returns the default Executor used for async methods that do not specify an Executor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` static `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)                                                                                           | ` `[delayedExecutor](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#delayedExecutor(long,%20java.util.concurrent.TimeUnit,%20java.util.concurrent.Executor))`(long delay, `[TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)` unit, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor) ` Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive).                                                                                                                                                                                                                                                                                                                                           |
| ` static `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)                                                                                           | ` `[delayedExecutor](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#delayedExecutor(long,%20java.util.concurrent.TimeUnit))`(long delay, `[TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)` unit) ` Returns a new Executor that submits a task to the default executor after the given delay (or no delay if non-positive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` `[Throwable](https://developer.android.com/reference/java/lang/Throwable)                                                                                                           | ` `[exceptionNow](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#exceptionNow())`() ` Returns the exception thrown by the task, without waiting.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[exceptionally](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#exceptionally(java.util.function.Function<java.lang.Throwable,?%20extends%20T>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? 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.                                                                                                                                                                                                                                                                                                                                      |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[exceptionallyAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#exceptionallyAsync(java.util.function.Function<java.lang.Throwable,?%20extends%20T>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? 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, using this stage's default asynchronous execution facility.                                                                                                                                                                                                                                                                |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[exceptionallyAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#exceptionallyAsync(java.util.function.Function<java.lang.Throwable,?%20extends%20T>,%20java.util.concurrent.Executor))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends T> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor) ` Returns a new CompletionStage that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function, using the supplied Executor.                                                                                                                                                                |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[exceptionallyCompose](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#exceptionallyCompose(java.util.function.Function<java.lang.Throwable,?%20extends%20java.util.concurrent.CompletionStage<T>>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>> fn) ` Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception.                                                                                                                                                                       |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[exceptionallyComposeAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#exceptionallyComposeAsync(java.util.function.Function<java.lang.Throwable,?%20extends%20java.util.concurrent.CompletionStage<T>>,%20java.util.concurrent.Executor))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor) ` Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using the supplied Executor. |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[exceptionallyComposeAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#exceptionallyComposeAsync(java.util.function.Function<java.lang.Throwable,?%20extends%20java.util.concurrent.CompletionStage<T>>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>> fn) ` Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using this stage's default asynchronous execution facility.                                                                                                 |
| ` static <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                | ` `[failedFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#failedFuture(java.lang.Throwable))`(`[Throwable](https://developer.android.com/reference/java/lang/Throwable)` ex) ` Returns a new CompletableFuture that is already completed exceptionally with the given exception.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` static <U> `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                    | ` `[failedStage](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#failedStage(java.lang.Throwable))`(`[Throwable](https://developer.android.com/reference/java/lang/Throwable)` ex) ` Returns a new CompletionStage that is already completed exceptionally with the given exception and supports only those methods in interface[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage).                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` T`                                                                                                                                                                                  | ` `[get](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#get(long,%20java.util.concurrent.TimeUnit))`(long timeout, `[TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture#get())`() ` Waits if necessary for this future to complete, and then returns its result.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` T`                                                                                                                                                                                  | ` `[getNow](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#getNow(T))`(T valueIfAbsent) ` Returns the result value (or throws any encountered exception) if completed, else returns the given valueIfAbsent.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` int`                                                                                                                                                                                | ` `[getNumberOfDependents](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#getNumberOfDependents())`() ` Returns the estimated number of CompletableFutures whose completions are awaiting completion of this CompletableFuture.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[handle](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#handle(java.util.function.BiFunction<?%20super%20T,java.lang.Throwable,?%20extends%20U>))`(`[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super T, `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[handleAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#handleAsync(java.util.function.BiFunction<?%20super%20T,java.lang.Throwable,?%20extends%20U>))`(`[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super T, `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? 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.                                                                                                                                                                                                                    |
| ` <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[handleAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#handleAsync(java.util.function.BiFunction<?%20super%20T,java.lang.Throwable,?%20extends%20U>,%20java.util.concurrent.Executor))`(`[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super T, `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends U> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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.                                                                                                                    |
| ` boolean`                                                                                                                                                                            | ` `[isCancelled](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#isCancelled())`() ` Returns`true`if this CompletableFuture was cancelled before it completed normally.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` boolean`                                                                                                                                                                            | ` `[isCompletedExceptionally](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#isCompletedExceptionally())`() ` Returns`true`if this CompletableFuture completed exceptionally, in any way.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` boolean`                                                                                                                                                                            | ` `[isDone](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#isDone())`() ` Returns`true`if completed in any fashion: normally, exceptionally, or via cancellation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` T`                                                                                                                                                                                  | ` `[join](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#join())`() ` Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                               | ` `[minimalCompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#minimalCompletionStage())`() ` Returns a new CompletionStage that is completed normally with the same value as this CompletableFuture when it completes normally, and cannot be independently completed or otherwise used in ways not defined by the methods of interface[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage).                                                                                                                                                                                                                                                                                                                                                                                     |
| ` <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[newIncompleteFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#newIncompleteFuture())`() ` Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` void`                                                                                                                                                                               | ` `[obtrudeException](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#obtrudeException(java.lang.Throwable))`(`[Throwable](https://developer.android.com/reference/java/lang/Throwable)` ex) ` Forcibly causes subsequent invocations of method[get()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#get())and related methods to throw the given exception, whether or not already completed.                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` void`                                                                                                                                                                               | ` `[obtrudeValue](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#obtrudeValue(T))`(T value) ` Forcibly sets or resets the value subsequently returned by method[get()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#get())and related methods, whether or not already completed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[orTimeout](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#orTimeout(long,%20java.util.concurrent.TimeUnit))`(long timeout, `[TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)` unit) ` Exceptionally completes this CompletableFuture with a[TimeoutException](https://developer.android.com/reference/java/util/concurrent/TimeoutException)if not otherwise completed before the given timeout.                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` T`                                                                                                                                                                                  | ` `[resultNow](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#resultNow())`() ` Returns the computed result, without waiting.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[runAfterBoth](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#runAfterBoth(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action) ` Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action.                                                                                                                                                                                                                                                                                                                                                                 |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[runAfterBothAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#runAfterBothAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[runAfterBothAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#runAfterBothAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[runAfterEither](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#runAfterEither(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action) ` Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action.                                                                                                                                                                                                                                                                                                                                                            |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[runAfterEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#runAfterEitherAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[runAfterEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#runAfterEitherAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[runAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#runAsync(java.lang.Runnable))`(`[Runnable](https://developer.android.com/reference/java/lang/Runnable)` runnable) ` Returns a new CompletableFuture that is asynchronously completed by a task running in the[ForkJoinPool.commonPool()](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool#commonPool())after it runs the given action.                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` static `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[runAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#runAsync(java.lang.Runnable,%20java.util.concurrent.Executor))`(`[Runnable](https://developer.android.com/reference/java/lang/Runnable)` runnable, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor) ` Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor after it runs the given action.                                                                                                                                                                                                                                                                                                                                                                                 |
| ` `[Future.State](https://developer.android.com/reference/java/util/concurrent/Future.State)                                                                                          | ` `[state](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#state())`() ` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` static <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                | ` `[supplyAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#supplyAsync(java.util.function.Supplier<U>))`(`[Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<U> supplier) ` Returns a new CompletableFuture that is asynchronously completed by a task running in the[ForkJoinPool.commonPool()](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool#commonPool())with the value obtained by calling the given Supplier.                                                                                                                                                                                                                                                                                                                                                        |
| ` static <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                | ` `[supplyAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#supplyAsync(java.util.function.Supplier<U>,%20java.util.concurrent.Executor))`(`[Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<U> supplier, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[thenAccept](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenAccept(java.util.function.Consumer<?%20super%20T>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[thenAcceptAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenAcceptAsync(java.util.function.Consumer<?%20super%20T>,%20java.util.concurrent.Executor))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super T> action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[thenAcceptAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenAcceptAsync(java.util.function.Consumer<?%20super%20T>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`        | ` `[thenAcceptBoth](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenAcceptBoth(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiConsumer<?%20super%20T,?%20super%20U>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`        | ` `[thenAcceptBothAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenAcceptBothAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiConsumer<?%20super%20T,?%20super%20U>,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? super T, ? super U> action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`        | ` `[thenAcceptBothAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenAcceptBothAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiConsumer<?%20super%20T,?%20super%20U>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[thenApply](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenApply(java.util.function.Function<?%20super%20T,?%20extends%20U>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[thenApplyAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenApplyAsync(java.util.function.Function<?%20super%20T,?%20extends%20U>,%20java.util.concurrent.Executor))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, ? extends U> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[thenApplyAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenApplyAsync(java.util.function.Function<?%20super%20T,?%20extends%20U>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? 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, V> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<V>`                                                                    | ` `[thenCombine](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenCombine(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiFunction<?%20super%20T,?%20super%20U,?%20extends%20V>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<V>`                                                                    | ` `[thenCombineAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenCombineAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiFunction<?%20super%20T,?%20super%20U,?%20extends%20V>,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super T, ? super U, ? extends V> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<V>`                                                                    | ` `[thenCombineAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenCombineAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiFunction<?%20super%20T,?%20super%20U,?%20extends%20V>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[thenCompose](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenCompose(java.util.function.Function<?%20super%20T,?%20extends%20java.util.concurrent.CompletionStage<U>>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>> fn) ` Returns a new CompletionStage that is completed with the same value as the CompletionStage returned by the given function.                                                                                                                                                                                                                                                                                                            |
| ` <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[thenComposeAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenComposeAsync(java.util.function.Function<?%20super%20T,?%20extends%20java.util.concurrent.CompletionStage<U>>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<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.                                                                                                                                                                                                                             |
| ` <U> `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>`                                                                       | ` `[thenComposeAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenComposeAsync(java.util.function.Function<?%20super%20T,?%20extends%20java.util.concurrent.CompletionStage<U>>,%20java.util.concurrent.Executor))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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.                                                                                                                             |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[thenRun](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenRun(java.lang.Runnable))`(`[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action) ` Returns a new CompletionStage that, when this stage completes normally, executes the given action.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[thenRunAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenRunAsync(java.lang.Runnable,%20java.util.concurrent.Executor))`(`[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor) ` Returns a new CompletionStage that, when this stage completes normally, executes the given action using the supplied Executor.                                                                                                                                                                                                                                                                                                                                                                                     |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`            | ` `[thenRunAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#thenRunAsync(java.lang.Runnable))`(`[Runnable](https://developer.android.com/reference/java/lang/Runnable)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[toCompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#toCompletableFuture())`() ` Returns this CompletableFuture.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                                                                 | ` `[toString](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#toString())`() ` Returns a string identifying this CompletableFuture, as well as its completion state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[whenComplete](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#whenComplete(java.util.function.BiConsumer<?%20super%20T,?%20super%20java.lang.Throwable>))`(`[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? super T, ? super `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`> 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[whenCompleteAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#whenCompleteAsync(java.util.function.BiConsumer<?%20super%20T,?%20super%20java.lang.Throwable>,%20java.util.concurrent.Executor))`(`[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? super T, ? super `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`> action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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.                                                                                                                                                               |
| ` `[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                           | ` `[whenCompleteAsync](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#whenCompleteAsync(java.util.function.BiConsumer<?%20super%20T,?%20super%20java.lang.Throwable>))`(`[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? super T, ? super `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`> 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.                                                                                                                                                                                                                                                               |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[java.util.concurrent.CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)` ` |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[acceptEither](https://developer.android.com/reference/java/util/concurrent/CompletionStage#acceptEither(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Consumer<?%20super%20T>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[acceptEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#acceptEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Consumer<?%20super%20T>,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super T> action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[acceptEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#acceptEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Consumer<?%20super%20T>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[applyToEither](https://developer.android.com/reference/java/util/concurrent/CompletionStage#applyToEither(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Function<?%20super%20T,U>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Function](https://developer.android.com/reference/java/util/function/Function)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[applyToEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#applyToEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Function<?%20super%20T,U>,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, U> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[applyToEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#applyToEitherAsync(java.util.concurrent.CompletionStage<?%20extends%20T>,%20java.util.function.Function<?%20super%20T,U>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends T> other, `[Function](https://developer.android.com/reference/java/util/function/Function)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                    | ` `[exceptionally](https://developer.android.com/reference/java/util/concurrent/CompletionStage#exceptionally(java.util.function.Function<java.lang.Throwable,?%20extends%20T>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? 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.                                                                                                                                                                                                                                                                                                                                      | | ` default `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                     | ` `[exceptionallyAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#exceptionallyAsync(java.util.function.Function<java.lang.Throwable,?%20extends%20T>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? 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, using this stage's default asynchronous execution facility.                                                                                                                                                                                                                                                                | | ` default `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                     | ` `[exceptionallyAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#exceptionallyAsync(java.util.function.Function<java.lang.Throwable,?%20extends%20T>,%20java.util.concurrent.Executor))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends T> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor) ` Returns a new CompletionStage that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function, using the supplied Executor.                                                                                                                                                                | | ` default `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                     | ` `[exceptionallyCompose](https://developer.android.com/reference/java/util/concurrent/CompletionStage#exceptionallyCompose(java.util.function.Function<java.lang.Throwable,?%20extends%20java.util.concurrent.CompletionStage<T>>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>> fn) ` Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception.                                                                                                                                                                       | | ` default `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                     | ` `[exceptionallyComposeAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#exceptionallyComposeAsync(java.util.function.Function<java.lang.Throwable,?%20extends%20java.util.concurrent.CompletionStage<T>>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>> fn) ` Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using this stage's default asynchronous execution facility.                                                                                                 | | ` default `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                     | ` `[exceptionallyComposeAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#exceptionallyComposeAsync(java.util.function.Function<java.lang.Throwable,?%20extends%20java.util.concurrent.CompletionStage<T>>,%20java.util.concurrent.Executor))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<`[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor) ` Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using the supplied Executor. | | ` abstract <U> `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[handle](https://developer.android.com/reference/java/util/concurrent/CompletionStage#handle(java.util.function.BiFunction<?%20super%20T,java.lang.Throwable,?%20extends%20U>))`(`[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super T, `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[handleAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#handleAsync(java.util.function.BiFunction<?%20super%20T,java.lang.Throwable,?%20extends%20U>))`(`[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super T, `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? 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 <U> `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[handleAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#handleAsync(java.util.function.BiFunction<?%20super%20T,java.lang.Throwable,?%20extends%20U>,%20java.util.concurrent.Executor))`(`[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super T, `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`, ? extends U> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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 `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[runAfterBoth](https://developer.android.com/reference/java/util/concurrent/CompletionStage#runAfterBoth(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action) ` Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action.                                                                                                                                                                                                                                                                                                                                                                 | | ` abstract `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[runAfterBothAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#runAfterBothAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[runAfterBothAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#runAfterBothAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[runAfterEither](https://developer.android.com/reference/java/util/concurrent/CompletionStage#runAfterEither(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action) ` Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action.                                                                                                                                                                                                                                                                                                                                                            | | ` abstract `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[runAfterEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#runAfterEitherAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[runAfterEitherAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#runAfterEitherAsync(java.util.concurrent.CompletionStage<?>,%20java.lang.Runnable,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<?> other, `[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[thenAccept](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenAccept(java.util.function.Consumer<?%20super%20T>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[thenAcceptAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenAcceptAsync(java.util.function.Consumer<?%20super%20T>,%20java.util.concurrent.Executor))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super T> action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[thenAcceptAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenAcceptAsync(java.util.function.Consumer<?%20super%20T>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | ` `[thenAcceptBoth](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenAcceptBoth(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiConsumer<?%20super%20T,?%20super%20U>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | ` `[thenAcceptBothAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenAcceptBothAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiConsumer<?%20super%20T,?%20super%20U>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | ` `[thenAcceptBothAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenAcceptBothAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiConsumer<?%20super%20T,?%20super%20U>,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? super T, ? super U> action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[thenApply](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenApply(java.util.function.Function<?%20super%20T,?%20extends%20U>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[thenApplyAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenApplyAsync(java.util.function.Function<?%20super%20T,?%20extends%20U>,%20java.util.concurrent.Executor))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, ? extends U> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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> `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[thenApplyAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenApplyAsync(java.util.function.Function<?%20super%20T,?%20extends%20U>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? 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, V> `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<V>`                                                             | ` `[thenCombine](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenCombine(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiFunction<?%20super%20T,?%20super%20U,?%20extends%20V>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<V>`                                                             | ` `[thenCombineAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenCombineAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiFunction<?%20super%20T,?%20super%20U,?%20extends%20V>))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<V>`                                                             | ` `[thenCombineAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenCombineAsync(java.util.concurrent.CompletionStage<?%20extends%20U>,%20java.util.function.BiFunction<?%20super%20T,?%20super%20U,?%20extends%20V>,%20java.util.concurrent.Executor))`(`[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<? extends U> other, `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super T, ? super U, ? extends V> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[thenCompose](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenCompose(java.util.function.Function<?%20super%20T,?%20extends%20java.util.concurrent.CompletionStage<U>>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[thenComposeAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenComposeAsync(java.util.function.Function<?%20super%20T,?%20extends%20java.util.concurrent.CompletionStage<U>>,%20java.util.concurrent.Executor))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>> fn, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>`                                                                | ` `[thenComposeAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenComposeAsync(java.util.function.Function<?%20super%20T,?%20extends%20java.util.concurrent.CompletionStage<U>>))`(`[Function](https://developer.android.com/reference/java/util/function/Function)`<? super T, ? extends `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[thenRun](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenRun(java.lang.Runnable))`(`[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action) ` Returns a new CompletionStage that, when this stage completes normally, executes the given action.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` abstract `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[thenRunAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenRunAsync(java.lang.Runnable,%20java.util.concurrent.Executor))`(`[Runnable](https://developer.android.com/reference/java/lang/Runnable)` action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor) ` Returns a new CompletionStage that, when this stage completes normally, executes the given action using the supplied Executor.                                                                                                                                                                                                                                                                                                                                                                                     | | ` abstract `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>`     | ` `[thenRunAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#thenRunAsync(java.lang.Runnable))`(`[Runnable](https://developer.android.com/reference/java/lang/Runnable)` 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://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>`                                                                | ` `[toCompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletionStage#toCompletableFuture())`() ` Returns a[CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)maintaining the same completion properties as this stage.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` abstract `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                    | ` `[whenComplete](https://developer.android.com/reference/java/util/concurrent/CompletionStage#whenComplete(java.util.function.BiConsumer<?%20super%20T,?%20super%20java.lang.Throwable>))`(`[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? super T, ? super `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`> 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://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                    | ` `[whenCompleteAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#whenCompleteAsync(java.util.function.BiConsumer<?%20super%20T,?%20super%20java.lang.Throwable>,%20java.util.concurrent.Executor))`(`[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? super T, ? super `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`> action, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` 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.                                                                                                                                                               | | ` abstract `[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>`                                                                    | ` `[whenCompleteAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#whenCompleteAsync(java.util.function.BiConsumer<?%20super%20T,?%20super%20java.lang.Throwable>))`(`[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? super T, ? super `[Throwable](https://developer.android.com/reference/java/lang/Throwable)`> 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.                                                                                                                                                                                                                                                               | ||
| From interface` `[java.util.concurrent.Future](https://developer.android.com/reference/java/util/concurrent/Future)` ` |------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean`                                                                                  | ` `[cancel](https://developer.android.com/reference/java/util/concurrent/Future#cancel(boolean))`(boolean mayInterruptIfRunning) ` Attempts to cancel execution of this task.                                                                                                                                                                                   | | ` default `[Throwable](https://developer.android.com/reference/java/lang/Throwable)                  | ` `[exceptionNow](https://developer.android.com/reference/java/util/concurrent/Future#exceptionNow())`() ` Returns the exception thrown by the task, without waiting.                                                                                                                                                                                           | | ` abstract T`                                                                                        | ` `[get](https://developer.android.com/reference/java/util/concurrent/Future#get(long,%20java.util.concurrent.TimeUnit))`(long timeout, `[TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)` 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://developer.android.com/reference/java/util/concurrent/Future#get())`() ` Waits if necessary for the computation to complete, and then retrieves its result.                                                                                                                                                                                     | | ` abstract boolean`                                                                                  | ` `[isCancelled](https://developer.android.com/reference/java/util/concurrent/Future#isCancelled())`() ` Returns`true`if this task was cancelled before it completed normally.                                                                                                                                                                                  | | ` abstract boolean`                                                                                  | ` `[isDone](https://developer.android.com/reference/java/util/concurrent/Future#isDone())`() ` Returns`true`if this task completed.                                                                                                                                                                                                                             | | ` default T`                                                                                         | ` `[resultNow](https://developer.android.com/reference/java/util/concurrent/Future#resultNow())`() ` Returns the computed result, without waiting.                                                                                                                                                                                                              | | ` default `[Future.State](https://developer.android.com/reference/java/util/concurrent/Future.State) | ` `[state](https://developer.android.com/reference/java/util/concurrent/Future#state())`() ` <br />                                                                                                                                                                                                                                                             | ||

## Public constructors

### CompletableFuture

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture ()
```

Creates a new incomplete CompletableFuture.

<br />

## Public methods

### acceptEither

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> acceptEither (CompletionStage<? extends T> other, 
                Consumer<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `other`  | `CompletionStage`: the other CompletionStage <br />                                     |
| `action` | `Consumer`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### acceptEitherAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> acceptEitherAsync (CompletionStage<? extends T> other, 
                Consumer<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `other`  | `CompletionStage`: the other CompletionStage <br />                                     |
| `action` | `Consumer`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### acceptEitherAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> acceptEitherAsync (CompletionStage<? extends T> other, 
                Consumer<? super T> action, 
                Executor 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                             Parameters                                              ||
|------------|-----------------------------------------------------------------------------------------|
| `other`    | `CompletionStage`: the other CompletionStage <br />                                     |
| `action`   | `Consumer`: the action to perform before completing the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                       |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### allOf

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletableFuture<Void> allOf (CompletableFuture...<?> 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();`.

<br />

|                        Parameters                         ||
|-------|----------------------------------------------------|
| `cfs` | `CompletableFuture`: the CompletableFutures <br /> |

|                                                                                                                                   Returns                                                                                                                                   ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | a new CompletableFuture that is completed when all of the given CompletableFutures complete <br /> |

|                                                                    Throws                                                                     ||
|------------------------------------------------------------------------------------------------|-----------------------------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the array or any of its elements are`null` |

### anyOf

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletableFuture<Object> anyOf (CompletableFuture...<?> 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.

<br />

|                        Parameters                         ||
|-------|----------------------------------------------------|
| `cfs` | `CompletableFuture`: the CompletableFutures <br /> |

|                                                                                                                                                       Returns                                                                                                                                                        ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Object](https://developer.android.com/reference/java/lang/Object)`>` | a new CompletableFuture that is completed with the result or exception of any of the given CompletableFutures when one completes <br /> |

|                                                                    Throws                                                                     ||
|------------------------------------------------------------------------------------------------|-----------------------------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the array or any of its elements are`null` |

### applyToEither

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> applyToEither (CompletionStage<? extends T> other, 
                Function<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                              Parameters                                              ||
|---------|---------------------------------------------------------------------------------------------|
| `other` | `CompletionStage`: the other CompletionStage <br />                                         |
| `fn`    | `Function`: the function to use to compute the value of the returned CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### applyToEitherAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> applyToEitherAsync (CompletionStage<? extends T> other, 
                Function<? super T, U> fn, 
                Executor 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                               Parameters                                                ||
|------------|---------------------------------------------------------------------------------------------|
| `other`    | `CompletionStage`: the other CompletionStage <br />                                         |
| `fn`       | `Function`: the function to use to compute the value of the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                           |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### applyToEitherAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> applyToEitherAsync (CompletionStage<? extends T> other, 
                Function<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                              Parameters                                              ||
|---------|---------------------------------------------------------------------------------------------|
| `other` | `CompletionStage`: the other CompletionStage <br />                                         |
| `fn`    | `Function`: the function to use to compute the value of the returned CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### cancel

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean cancel (boolean mayInterruptIfRunning)
```

If not already completed, completes this CompletableFuture with a[CancellationException](https://developer.android.com/reference/java/util/concurrent/CancellationException). Dependent CompletableFutures that have not already completed will also complete exceptionally, with a[CompletionException](https://developer.android.com/reference/java/util/concurrent/CompletionException)caused by this`CancellationException`.

<br />

|                                                                    Parameters                                                                     ||
|-------------------------|--------------------------------------------------------------------------------------------------------------------------|
| `mayInterruptIfRunning` | `boolean`: this value has no effect in this implementation because interrupts are not used to control processing. <br /> |

|                        Returns                        ||
|-----------|--------------------------------------------|
| `boolean` | `true`if this task is now cancelled <br /> |

### complete

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean complete (T value)
```

If not already completed, sets the value returned by[get()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#get())and related methods to the given value.

<br />

|              Parameters               ||
|---------|------------------------------|
| `value` | `T`: the result value <br /> |

|                                                         Returns                                                          ||
|-----------|---------------------------------------------------------------------------------------------------------------|
| `boolean` | `true`if this invocation caused this CompletableFuture to transition to a completed state, else`false` <br /> |

### completeAsync

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> completeAsync (Supplier<? extends T> supplier, 
                Executor executor)
```

Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor.

<br />

|                                                 Parameters                                                  ||
|------------|-------------------------------------------------------------------------------------------------|
| `supplier` | `Supplier`: a function returning the value to be used to complete this CompletableFuture <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                               |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------|-------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | this CompletableFuture <br /> |

### completeAsync

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> completeAsync (Supplier<? extends T> supplier)
```

Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor.

<br />

|                                                 Parameters                                                  ||
|------------|-------------------------------------------------------------------------------------------------|
| `supplier` | `Supplier`: a function returning the value to be used to complete this CompletableFuture <br /> |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------|-------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | this CompletableFuture <br /> |

### completeExceptionally

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean completeExceptionally (Throwable ex)
```

If not already completed, causes invocations of[get()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#get())and related methods to throw the given exception.

<br />

|               Parameters                ||
|------|-----------------------------------|
| `ex` | `Throwable`: the exception <br /> |

|                                                         Returns                                                          ||
|-----------|---------------------------------------------------------------------------------------------------------------|
| `boolean` | `true`if this invocation caused this CompletableFuture to transition to a completed state, else`false` <br /> |

### completeOnTimeout

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> completeOnTimeout (T value, 
                long timeout, 
                TimeUnit unit)
```

Completes this CompletableFuture with the given value if not otherwise completed before the given timeout.

<br />

|                                                  Parameters                                                   ||
|-----------|----------------------------------------------------------------------------------------------------|
| `value`   | `T`: the value to use upon timeout <br />                                                          |
| `timeout` | `long`: how long to wait before completing normally with the given value, in units of`unit` <br /> |
| `unit`    | `TimeUnit`: a`TimeUnit`determining how to interpret the`timeout`parameter <br />                   |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------|-------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | this CompletableFuture <br /> |

### completedFuture

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletableFuture<U> completedFuture (U value)
```

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

<br />

|           Parameters           ||
|---------|-----------------------|
| `value` | `U`: the value <br /> |

|                                                                     Returns                                                                      ||
|----------------------------------------------------------------------------------------------------------|----------------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the completed CompletableFuture <br /> |

### completedStage

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletionStage<U> completedStage (U value)
```

Returns a new CompletionStage that is already completed with the given value and supports only those methods in interface[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage).

<br />

|           Parameters           ||
|---------|-----------------------|
| `value` | `U`: the value <br /> |

|                                                                  Returns                                                                   ||
|------------------------------------------------------------------------------------------------------|--------------------------------------|
| [CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>` | the completed CompletionStage <br /> |

### copy

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> copy ()
```

Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally. If this CompletableFuture completes exceptionally, then the returned CompletableFuture completes exceptionally with a CompletionException with this exception as cause. The behavior is equivalent to`thenApply(x -> x)`. This method may be useful as a form of "defensive copying", to prevent clients from completing, while still being able to arrange dependent actions.

<br />

|                                                                  Returns                                                                   ||
|----------------------------------------------------------------------------------------------------------|----------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletableFuture <br /> |

### defaultExecutor

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Executor defaultExecutor ()
```

Returns the default Executor used for async methods that do not specify an Executor. This class uses the[ForkJoinPool.commonPool()](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool#commonPool())if it supports more than one parallel thread, or else an Executor using one thread per async task. This method may be overridden in subclasses to return an Executor that provides at least one independent thread.

<br />

|                                                Returns                                                 ||
|-----------------------------------------------------------------------------------|---------------------|
| [Executor](https://developer.android.com/reference/java/util/concurrent/Executor) | the executor <br /> |

### delayedExecutor

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static Executor delayedExecutor (long delay, 
                TimeUnit unit, 
                Executor executor)
```

Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor's`execute`method.

<br />

|                                         Parameters                                         ||
|------------|--------------------------------------------------------------------------------|
| `delay`    | `long`: how long to delay, in units of`unit` <br />                            |
| `unit`     | `TimeUnit`: a`TimeUnit`determining how to interpret the`delay`parameter <br /> |
| `executor` | `Executor`: the base executor <br />                                           |

|                                                      Returns                                                       ||
|-----------------------------------------------------------------------------------|---------------------------------|
| [Executor](https://developer.android.com/reference/java/util/concurrent/Executor) | the new delayed executor <br /> |

### delayedExecutor

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static Executor delayedExecutor (long delay, 
                TimeUnit unit)
```

Returns a new Executor that submits a task to the default executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor's`execute`method.

<br />

|                                       Parameters                                        ||
|---------|--------------------------------------------------------------------------------|
| `delay` | `long`: how long to delay, in units of`unit` <br />                            |
| `unit`  | `TimeUnit`: a`TimeUnit`determining how to interpret the`delay`parameter <br /> |

|                                                      Returns                                                       ||
|-----------------------------------------------------------------------------------|---------------------------------|
| [Executor](https://developer.android.com/reference/java/util/concurrent/Executor) | the new delayed executor <br /> |

### exceptionNow

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Throwable exceptionNow ()
```

Returns the exception thrown by the task, without waiting.

This method is for cases where the caller knows that the task has already completed with an exception.

<br />

|                                                      Returns                                                      ||
|--------------------------------------------------------------------------|-----------------------------------------|
| [Throwable](https://developer.android.com/reference/java/lang/Throwable) | the exception thrown by the task <br /> |

### exceptionally

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> exceptionally (Function<Throwable, ? extends T> fn)
```

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

<br />

|                                                                    Parameters                                                                     ||
|------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `fn` | `Function`: the function to use to compute the value of the returned CompletionStage if this CompletionStage completed exceptionally <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletionStage <br /> |

### exceptionallyAsync

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> exceptionallyAsync (Function<Throwable, ? 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, using this stage's default asynchronous execution facility. Otherwise, if this stage completes normally, then the returned stage also completes normally with the same value.

<br />

|                                                                    Parameters                                                                     ||
|------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `fn` | `Function`: the function to use to compute the value of the returned CompletionStage if this CompletionStage completed exceptionally <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletionStage <br /> |

### exceptionallyAsync

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> exceptionallyAsync (Function<Throwable, ? extends T> fn, 
                Executor executor)
```

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

<br />

|                                                                       Parameters                                                                        ||
|------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `fn`       | `Function`: the function to use to compute the value of the returned CompletionStage if this CompletionStage completed exceptionally <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                                                                           |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletionStage <br /> |

### exceptionallyCompose

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> exceptionallyCompose (Function<Throwable, ? extends CompletionStage<T>> fn)
```

Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception.

<br />

|                                                              Parameters                                                              ||
|------|--------------------------------------------------------------------------------------------------------------------------------|
| `fn` | `Function`: the function to use to compute the returned CompletionStage if this CompletionStage completed exceptionally <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletionStage <br /> |

### exceptionallyComposeAsync

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> exceptionallyComposeAsync (Function<Throwable, ? extends CompletionStage<T>> fn, 
                Executor executor)
```

Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using the supplied Executor.

<br />

|                                                                 Parameters                                                                 ||
|------------|--------------------------------------------------------------------------------------------------------------------------------|
| `fn`       | `Function`: the function to use to compute the returned CompletionStage if this CompletionStage completed exceptionally <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                                                              |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletionStage <br /> |

### exceptionallyComposeAsync

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> exceptionallyComposeAsync (Function<Throwable, ? extends CompletionStage<T>> fn)
```

Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using this stage's default asynchronous execution facility.

<br />

|                                                              Parameters                                                              ||
|------|--------------------------------------------------------------------------------------------------------------------------------|
| `fn` | `Function`: the function to use to compute the returned CompletionStage if this CompletionStage completed exceptionally <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletionStage <br /> |

### failedFuture

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletableFuture<U> failedFuture (Throwable ex)
```

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

<br />

|               Parameters                ||
|------|-----------------------------------|
| `ex` | `Throwable`: the exception <br /> |

|                                                                            Returns                                                                             ||
|----------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the exceptionally completed CompletableFuture <br /> |

### failedStage

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletionStage<U> failedStage (Throwable ex)
```

Returns a new CompletionStage that is already completed exceptionally with the given exception and supports only those methods in interface[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage).

<br />

|               Parameters                ||
|------|-----------------------------------|
| `ex` | `Throwable`: the exception <br /> |

|                                                                         Returns                                                                          ||
|------------------------------------------------------------------------------------------------------|----------------------------------------------------|
| [CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<U>` | the exceptionally completed CompletionStage <br /> |

### get

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public T get (long timeout, 
                TimeUnit unit)
```

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

<br />

|                             Parameters                              ||
|-----------|----------------------------------------------------------|
| `timeout` | `long`: the maximum time to wait <br />                  |
| `unit`    | `TimeUnit`: the time unit of the timeout argument <br /> |

|           Returns            ||
|-----|-------------------------|
| `T` | the result value <br /> |

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

### get

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public T get ()
```

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

<br />

|           Returns            ||
|-----|-------------------------|
| `T` | the result value <br /> |

|                                                                              Throws                                                                              ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| [CancellationException](https://developer.android.com/reference/java/util/concurrent/CancellationException) | if this future was cancelled                        |
| [ExecutionException](https://developer.android.com/reference/java/util/concurrent/ExecutionException)       | if this future completed exceptionally              |
| [InterruptedException](https://developer.android.com/reference/java/lang/InterruptedException)              | if the current thread was interrupted while waiting |

### getNow

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public T getNow (T valueIfAbsent)
```

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

<br />

|                            Parameters                             ||
|-----------------|--------------------------------------------------|
| `valueIfAbsent` | `T`: the value to return if not completed <br /> |

|                                 Returns                                  ||
|-----|---------------------------------------------------------------------|
| `T` | the result value, if completed, else the given valueIfAbsent <br /> |

|                                                                                               Throws                                                                                               ||
|-------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
| [CancellationException](https://developer.android.com/reference/java/util/concurrent/CancellationException) | if the computation was cancelled                                                      |
| [CompletionException](https://developer.android.com/reference/java/util/concurrent/CompletionException)     | if this future completed exceptionally or a completion computation threw an exception |

### getNumberOfDependents

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
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.

<br />

|                         Returns                          ||
|-------|---------------------------------------------------|
| `int` | the number of dependent CompletableFutures <br /> |

### handle

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> handle (BiFunction<? super T, Throwable, ? 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.

<br />

|                                             Parameters                                              ||
|------|-----------------------------------------------------------------------------------------------|
| `fn` | `BiFunction`: the function to use to compute the value of the returned CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### handleAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> handleAsync (BiFunction<? super T, Throwable, ? 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.

<br />

|                                             Parameters                                              ||
|------|-----------------------------------------------------------------------------------------------|
| `fn` | `BiFunction`: the function to use to compute the value of the returned CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### handleAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> handleAsync (BiFunction<? super T, Throwable, ? extends U> fn, 
                Executor 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.

<br />

|                                                Parameters                                                 ||
|------------|-----------------------------------------------------------------------------------------------|
| `fn`       | `BiFunction`: the function to use to compute the value of the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                             |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### isCancelled

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isCancelled ()
```

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

<br />

|                                           Returns                                            ||
|-----------|-----------------------------------------------------------------------------------|
| `boolean` | `true`if this CompletableFuture was cancelled before it completed normally <br /> |

### isCompletedExceptionally

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
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.

<br />

|                                  Returns                                  ||
|-----------|----------------------------------------------------------------|
| `boolean` | `true`if this CompletableFuture completed exceptionally <br /> |

### isDone

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isDone ()
```

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

<br />

|               Returns                ||
|-----------|---------------------------|
| `boolean` | `true`if completed <br /> |

### join

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
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)[CompletionException](https://developer.android.com/reference/java/util/concurrent/CompletionException)with the underlying exception as its cause.

<br />

|           Returns            ||
|-----|-------------------------|
| `T` | the result value <br /> |

|                                                                                               Throws                                                                                               ||
|-------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
| [CancellationException](https://developer.android.com/reference/java/util/concurrent/CancellationException) | if the computation was cancelled                                                      |
| [CompletionException](https://developer.android.com/reference/java/util/concurrent/CompletionException)     | if this future completed exceptionally or a completion computation threw an exception |

### minimalCompletionStage

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletionStage<T> minimalCompletionStage ()
```

Returns a new CompletionStage that is completed normally with the same value as this CompletableFuture when it completes normally, and cannot be independently completed or otherwise used in ways not defined by the methods of interface[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage). If this CompletableFuture completes exceptionally, then the returned CompletionStage completes exceptionally with a CompletionException with this exception as cause.

Unless overridden by a subclass, a new non-minimal CompletableFuture with all methods available can be obtained from a minimal CompletionStage via[toCompletableFuture()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#toCompletableFuture()). For example, completion of a minimal stage can be awaited by  

     minimalStage.toCompletableFuture().join(); 

<br />

<br />

|                                                               Returns                                                                ||
|------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)`<T>` | the new CompletionStage <br /> |

### newIncompleteFuture

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> newIncompleteFuture ()
```

Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method. Subclasses should normally override this method to return an instance of the same class as this CompletableFuture. The default implementation returns an instance of class CompletableFuture.

<br />

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | a new CompletableFuture <br /> |

### obtrudeException

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void obtrudeException (Throwable ex)
```

Forcibly causes subsequent invocations of method[get()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#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.

<br />

|               Parameters                ||
|------|-----------------------------------|
| `ex` | `Throwable`: the exception <br /> |

|                                                          Throws                                                          ||
|------------------------------------------------------------------------------------------------|--------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the exception is null |

### obtrudeValue

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void obtrudeValue (T value)
```

Forcibly sets or resets the value subsequently returned by method[get()](https://developer.android.com/reference/java/util/concurrent/CompletableFuture#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.

<br />

|                Parameters                 ||
|---------|----------------------------------|
| `value` | `T`: the completion value <br /> |

### orTimeout

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> orTimeout (long timeout, 
                TimeUnit unit)
```

Exceptionally completes this CompletableFuture with a[TimeoutException](https://developer.android.com/reference/java/util/concurrent/TimeoutException)if not otherwise completed before the given timeout.

<br />

|                                                      Parameters                                                       ||
|-----------|------------------------------------------------------------------------------------------------------------|
| `timeout` | `long`: how long to wait before completing exceptionally with a TimeoutException, in units of`unit` <br /> |
| `unit`    | `TimeUnit`: a`TimeUnit`determining how to interpret the`timeout`parameter <br />                           |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------|-------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | this CompletableFuture <br /> |

### resultNow

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public T resultNow ()
```

Returns the computed result, without waiting.

This method is for cases where the caller knows that the task has already completed successfully, for example when filtering a stream of Future objects for the successful tasks and using a mapping operation to obtain a stream of results.`lang=java :
results = futures.stream()
.filter(f -> f.state() == Future.State.SUCCESS)
.map(Future::resultNow)
.toList();
`

<br />

|             Returns             ||
|-----|----------------------------|
| `T` | the computed result <br /> |

### runAfterBoth

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> runAfterBoth (CompletionStage<?> other, 
                Runnable action)
```

Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action. See the[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `other`  | `CompletionStage`: the other CompletionStage <br />                                     |
| `action` | `Runnable`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### runAfterBothAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> runAfterBothAsync (CompletionStage<?> other, 
                Runnable 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `other`  | `CompletionStage`: the other CompletionStage <br />                                     |
| `action` | `Runnable`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### runAfterBothAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> runAfterBothAsync (CompletionStage<?> other, 
                Runnable action, 
                Executor 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                             Parameters                                              ||
|------------|-----------------------------------------------------------------------------------------|
| `other`    | `CompletionStage`: the other CompletionStage <br />                                     |
| `action`   | `Runnable`: the action to perform before completing the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                       |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### runAfterEither

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> runAfterEither (CompletionStage<?> other, 
                Runnable action)
```

Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action. See the[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `other`  | `CompletionStage`: the other CompletionStage <br />                                     |
| `action` | `Runnable`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### runAfterEitherAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> runAfterEitherAsync (CompletionStage<?> other, 
                Runnable action, 
                Executor 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                             Parameters                                              ||
|------------|-----------------------------------------------------------------------------------------|
| `other`    | `CompletionStage`: the other CompletionStage <br />                                     |
| `action`   | `Runnable`: the action to perform before completing the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                       |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### runAfterEitherAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> runAfterEitherAsync (CompletionStage<?> other, 
                Runnable 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `other`  | `CompletionStage`: the other CompletionStage <br />                                     |
| `action` | `Runnable`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### runAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletableFuture<Void> runAsync (Runnable runnable)
```

Returns a new CompletableFuture that is asynchronously completed by a task running in the[ForkJoinPool.commonPool()](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool#commonPool())after it runs the given action.

<br />

|                                            Parameters                                             ||
|------------|---------------------------------------------------------------------------------------|
| `runnable` | `Runnable`: the action to run before completing the returned CompletableFuture <br /> |

|                                                                                                  Returns                                                                                                  ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletableFuture <br /> |

### runAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletableFuture<Void> runAsync (Runnable runnable, 
                Executor executor)
```

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

<br />

|                                            Parameters                                             ||
|------------|---------------------------------------------------------------------------------------|
| `runnable` | `Runnable`: the action to run before completing the returned CompletableFuture <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                     |

|                                                                                                  Returns                                                                                                  ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletableFuture <br /> |

### state

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Future.State state ()
```

<br />

<br />

|                                                         Returns                                                         ||
|-------------------------------------------------------------------------------------------|------------------------------|
| [Future.State](https://developer.android.com/reference/java/util/concurrent/Future.State) | the computation state <br /> |

### supplyAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletableFuture<U> supplyAsync (Supplier<U> supplier)
```

Returns a new CompletableFuture that is asynchronously completed by a task running in the[ForkJoinPool.commonPool()](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool#commonPool())with the value obtained by calling the given Supplier.

<br />

|                                                     Parameters                                                      ||
|------------|---------------------------------------------------------------------------------------------------------|
| `supplier` | `Supplier`: a function returning the value to be used to complete the returned CompletableFuture <br /> |

|                                                                  Returns                                                                   ||
|----------------------------------------------------------------------------------------------------------|----------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletableFuture <br /> |

### supplyAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static CompletableFuture<U> supplyAsync (Supplier<U> supplier, 
                Executor 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.

<br />

|                                                     Parameters                                                      ||
|------------|---------------------------------------------------------------------------------------------------------|
| `supplier` | `Supplier`: a function returning the value to be used to complete the returned CompletableFuture <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                                       |

|                                                                  Returns                                                                   ||
|----------------------------------------------------------------------------------------------------------|----------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletableFuture <br /> |

### thenAccept

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> thenAccept (Consumer<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `action` | `Consumer`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### thenAcceptAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> thenAcceptAsync (Consumer<? super T> action, 
                Executor 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                             Parameters                                              ||
|------------|-----------------------------------------------------------------------------------------|
| `action`   | `Consumer`: the action to perform before completing the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                       |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### thenAcceptAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> thenAcceptAsync (Consumer<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `action` | `Consumer`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### thenAcceptBoth

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> thenAcceptBoth (CompletionStage<? extends U> other, 
                BiConsumer<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                             Parameters                                              ||
|----------|-------------------------------------------------------------------------------------------|
| `other`  | `CompletionStage`: the other CompletionStage <br />                                       |
| `action` | `BiConsumer`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### thenAcceptBothAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> thenAcceptBothAsync (CompletionStage<? extends U> other, 
                BiConsumer<? super T, ? super U> action, 
                Executor 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                              Parameters                                               ||
|------------|-------------------------------------------------------------------------------------------|
| `other`    | `CompletionStage`: the other CompletionStage <br />                                       |
| `action`   | `BiConsumer`: the action to perform before completing the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                         |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### thenAcceptBothAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> thenAcceptBothAsync (CompletionStage<? extends U> other, 
                BiConsumer<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                             Parameters                                              ||
|----------|-------------------------------------------------------------------------------------------|
| `other`  | `CompletionStage`: the other CompletionStage <br />                                       |
| `action` | `BiConsumer`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### thenApply

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> thenApply (Function<? 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[Optional.map](https://developer.android.com/reference/java/util/Optional#map(java.util.function.Function<?%20super%20T,?%20extends%20U>))and[Stream.map](https://developer.android.com/reference/java/util/stream/Stream#map(java.util.function.Function<?%20super%20T,?%20extends%20R>)).

See the[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|------|---------------------------------------------------------------------------------------------|
| `fn` | `Function`: the function to use to compute the value of the returned CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### thenApplyAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> thenApplyAsync (Function<? super T, ? extends U> fn, 
                Executor 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                               Parameters                                                ||
|------------|---------------------------------------------------------------------------------------------|
| `fn`       | `Function`: the function to use to compute the value of the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                           |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### thenApplyAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> thenApplyAsync (Function<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|------|---------------------------------------------------------------------------------------------|
| `fn` | `Function`: the function to use to compute the value of the returned CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### thenCombine

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<V> thenCombine (CompletionStage<? extends U> other, 
                BiFunction<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                               Parameters                                               ||
|---------|-----------------------------------------------------------------------------------------------|
| `other` | `CompletionStage`: the other CompletionStage <br />                                           |
| `fn`    | `BiFunction`: the function to use to compute the value of the returned CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<V>` | the new CompletionStage <br /> |

### thenCombineAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<V> thenCombineAsync (CompletionStage<? extends U> other, 
                BiFunction<? super T, ? super U, ? extends V> fn, 
                Executor 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                                Parameters                                                 ||
|------------|-----------------------------------------------------------------------------------------------|
| `other`    | `CompletionStage`: the other CompletionStage <br />                                           |
| `fn`       | `BiFunction`: the function to use to compute the value of the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                             |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<V>` | the new CompletionStage <br /> |

### thenCombineAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<V> thenCombineAsync (CompletionStage<? extends U> other, 
                BiFunction<? 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                               Parameters                                               ||
|---------|-----------------------------------------------------------------------------------------------|
| `other` | `CompletionStage`: the other CompletionStage <br />                                           |
| `fn`    | `BiFunction`: the function to use to compute the value of the returned CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<V>` | the new CompletionStage <br /> |

### thenCompose

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> thenCompose (Function<? super T, ? extends CompletionStage<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[Optional.flatMap](https://developer.android.com/reference/java/util/Optional#flatMap(java.util.function.Function<?%20super%20T,?%20extends%20java.util.Optional<?%20extends%20U>>))and[Stream.flatMap](https://developer.android.com/reference/java/util/stream/Stream#flatMap(java.util.function.Function<?%20super%20T,?%20extends%20java.util.stream.Stream<?%20extends%20R>>)).

See the[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                   Parameters                                    ||
|------|---------------------------------------------------------------------------|
| `fn` | `Function`: the function to use to compute another CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### thenComposeAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> thenComposeAsync (Function<? super T, ? extends CompletionStage<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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                   Parameters                                    ||
|------|---------------------------------------------------------------------------|
| `fn` | `Function`: the function to use to compute another CompletionStage <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### thenComposeAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<U> thenComposeAsync (Function<? super T, ? extends CompletionStage<U>> fn, 
                Executor 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                      Parameters                                       ||
|------------|---------------------------------------------------------------------------|
| `fn`       | `Function`: the function to use to compute another CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />         |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<U>` | the new CompletionStage <br /> |

### thenRun

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> thenRun (Runnable action)
```

Returns a new CompletionStage that, when this stage completes normally, executes the given action. See the[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `action` | `Runnable`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### thenRunAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> thenRunAsync (Runnable action, 
                Executor executor)
```

Returns a new CompletionStage that, when this stage completes normally, executes the given action using the supplied Executor. See the[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                             Parameters                                              ||
|------------|-----------------------------------------------------------------------------------------|
| `action`   | `Runnable`: the action to perform before completing the returned CompletionStage <br /> |
| `executor` | `Executor`: the executor to use for asynchronous execution <br />                       |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### thenRunAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<Void> thenRunAsync (Runnable 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[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)documentation for rules covering exceptional completion.

<br />

|                                            Parameters                                             ||
|----------|-----------------------------------------------------------------------------------------|
| `action` | `Runnable`: the action to perform before completing the returned CompletionStage <br /> |

|                                                                                                 Returns                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | the new CompletionStage <br /> |

### toCompletableFuture

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> toCompletableFuture ()
```

Returns this CompletableFuture.

<br />

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------|-------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | this CompletableFuture <br /> |

### toString

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String 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.

<br />

|                                                                   Returns                                                                    ||
|--------------------------------------------------------------------|--------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | a string identifying this CompletableFuture, as well as its state <br /> |

### whenComplete

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> whenComplete (BiConsumer<? super T, ? super Throwable> 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[handle](https://developer.android.com/reference/java/util/concurrent/CompletionStage#handle(java.util.function.BiFunction<?%20super%20T,java.lang.Throwable,?%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.

<br />

|                      Parameters                      ||
|----------|--------------------------------------------|
| `action` | `BiConsumer`: the action to perform <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletionStage <br /> |

### whenCompleteAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> whenCompleteAsync (BiConsumer<? super T, ? super Throwable> action, 
                Executor 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[handleAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#handleAsync(java.util.function.BiFunction<?%20super%20T,java.lang.Throwable,?%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.

<br />

|                                  Parameters                                   ||
|------------|-------------------------------------------------------------------|
| `action`   | `BiConsumer`: the action to perform <br />                        |
| `executor` | `Executor`: the executor to use for asynchronous execution <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletionStage <br /> |

### whenCompleteAsync

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CompletableFuture<T> whenCompleteAsync (BiConsumer<? super T, ? super Throwable> 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[handleAsync](https://developer.android.com/reference/java/util/concurrent/CompletionStage#handleAsync(java.util.function.BiFunction<?%20super%20T,java.lang.Throwable,?%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.

<br />

|                      Parameters                      ||
|----------|--------------------------------------------|
| `action` | `BiConsumer`: the action to perform <br /> |

|                                                                 Returns                                                                  ||
|----------------------------------------------------------------------------------------------------------|--------------------------------|
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)`<T>` | the new CompletionStage <br /> |