Uses of Class java.util.concurrent.CompletableFuture (Java SE 9 & JDK 9 )

## Uses of Class
java.util.concurrent.CompletableFuture

- Packages that use CompletableFuture
  Package | Description
  --- | ---
  java.lang | Provides classes that are fundamental to the design of the Java programming language.
  java.util.concurrent | Utility classes commonly useful in concurrent programming.
  jdk.incubator.http | High level HTTP and WebSocket API

- - ### Uses of CompletableFuture in java.lang

    Methods in java.lang that return CompletableFuture
    Modifier and Type | Method | Description
    --- | --- | ---
    `CompletableFuture<Process>` | Process.`onExit​()` | Returns a `CompletableFuture<Process>` for the termination of the Process.
    `CompletableFuture<ProcessHandle>` | ProcessHandle.`onExit​()` | Returns a `CompletableFuture<ProcessHandle>` for the termination of the process.

  - ### Uses of CompletableFuture in java.util.concurrent

    Methods in java.util.concurrent that return CompletableFuture
    Modifier and Type | Method | Description
    --- | --- | ---
    `CompletableFuture<Void>` | CompletableFuture.`acceptEither​(CompletionStage<? extends T> other, Consumer<? super T> action)` |
    `CompletableFuture<Void>` | CompletableFuture.`acceptEitherAsync​(CompletionStage<? extends T> other, Consumer<? super T> action)` |
    `CompletableFuture<Void>` | CompletableFuture.`acceptEitherAsync​(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)` |
    `static CompletableFuture<Void>` | CompletableFuture.`allOf​(CompletableFuture<?>... cfs)` | Returns a new CompletableFuture that is completed when all of the given CompletableFutures complete.
    `static CompletableFuture<Object>` | CompletableFuture.`anyOf​(CompletableFuture<?>... cfs)` | Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result.
    `<U> CompletableFuture<U>` | CompletableFuture.`applyToEither​(CompletionStage<? extends T> other, Function<? super T,U> fn)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`applyToEitherAsync​(CompletionStage<? extends T> other, Function<? super T,U> fn)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`applyToEitherAsync​(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)` |
    `CompletableFuture<T>` | CompletableFuture.`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.
    `CompletableFuture<T>` | CompletableFuture.`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.
    `static <U> CompletableFuture<U>` | CompletableFuture.`completedFuture​(U value)` | Returns a new CompletableFuture that is already completed with the given value.
    `CompletableFuture<T>` | CompletableFuture.`completeOnTimeout​(T value, long timeout, TimeUnit unit)` | Completes this CompletableFuture with the given value if not otherwise completed before the given timeout.
    `CompletableFuture<Void>` | SubmissionPublisher.`consume​(Consumer<? super T> consumer)` | Processes all published items using the given Consumer function.
    `CompletableFuture<T>` | CompletableFuture.`copy​()` | Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally.
    `CompletableFuture<T>` | CompletableFuture.`exceptionally​(Function<Throwable,? extends T> fn)` | Returns a new CompletableFuture that is completed when this CompletableFuture completes, with the result of the given function of the exception triggering this CompletableFuture's completion when it completes exceptionally; otherwise, if this CompletableFuture completes normally, then the returned CompletableFuture also completes normally with the same value.
    `static <U> CompletableFuture<U>` | CompletableFuture.`failedFuture​(Throwable ex)` | Returns a new CompletableFuture that is already completed exceptionally with the given exception.
    `<U> CompletableFuture<U>` | CompletableFuture.`handle​(BiFunction<? super T,Throwable,? extends U> fn)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`handleAsync​(BiFunction<? super T,Throwable,? extends U> fn)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`handleAsync​(BiFunction<? super T,Throwable,? extends U> fn, Executor executor)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`newIncompleteFuture​()` | Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method.
    `CompletableFuture<T>` | CompletableFuture.`orTimeout​(long timeout, TimeUnit unit)` | Exceptionally completes this CompletableFuture with a `TimeoutException` if not otherwise completed before the given timeout.
    `CompletableFuture<Void>` | CompletableFuture.`runAfterBoth​(CompletionStage<?> other, Runnable action)` |
    `CompletableFuture<Void>` | CompletableFuture.`runAfterBothAsync​(CompletionStage<?> other, Runnable action)` |
    `CompletableFuture<Void>` | CompletableFuture.`runAfterBothAsync​(CompletionStage<?> other, Runnable action, Executor executor)` |
    `CompletableFuture<Void>` | CompletableFuture.`runAfterEither​(CompletionStage<?> other, Runnable action)` |
    `CompletableFuture<Void>` | CompletableFuture.`runAfterEitherAsync​(CompletionStage<?> other, Runnable action)` |
    `CompletableFuture<Void>` | CompletableFuture.`runAfterEitherAsync​(CompletionStage<?> other, Runnable action, Executor executor)` |
    `static CompletableFuture<Void>` | CompletableFuture.`runAsync​(Runnable runnable)` | Returns a new CompletableFuture that is asynchronously completed by a task running in the `ForkJoinPool.commonPool()` after it runs the given action.
    `static CompletableFuture<Void>` | CompletableFuture.`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.
    `static <U> CompletableFuture<U>` | CompletableFuture.`supplyAsync​(Supplier<U> supplier)` | Returns a new CompletableFuture that is asynchronously completed by a task running in the `ForkJoinPool.commonPool()` with the value obtained by calling the given Supplier.
    `static <U> CompletableFuture<U>` | CompletableFuture.`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.
    `CompletableFuture<Void>` | CompletableFuture.`thenAccept​(Consumer<? super T> action)` |
    `CompletableFuture<Void>` | CompletableFuture.`thenAcceptAsync​(Consumer<? super T> action)` |
    `CompletableFuture<Void>` | CompletableFuture.`thenAcceptAsync​(Consumer<? super T> action, Executor executor)` |
    `<U> CompletableFuture<Void>` | CompletableFuture.`thenAcceptBoth​(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)` |
    `<U> CompletableFuture<Void>` | CompletableFuture.`thenAcceptBothAsync​(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)` |
    `<U> CompletableFuture<Void>` | CompletableFuture.`thenAcceptBothAsync​(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`thenApply​(Function<? super T,? extends U> fn)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`thenApplyAsync​(Function<? super T,? extends U> fn)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`thenApplyAsync​(Function<? super T,? extends U> fn, Executor executor)` |
    `<U,V> CompletableFuture<V>` | CompletableFuture.`thenCombine​(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)` |
    `<U,V> CompletableFuture<V>` | CompletableFuture.`thenCombineAsync​(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)` |
    `<U,V> CompletableFuture<V>` | CompletableFuture.`thenCombineAsync​(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`thenCompose​(Function<? super T,? extends CompletionStage<U>> fn)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`thenComposeAsync​(Function<? super T,? extends CompletionStage<U>> fn)` |
    `<U> CompletableFuture<U>` | CompletableFuture.`thenComposeAsync​(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)` |
    `CompletableFuture<Void>` | CompletableFuture.`thenRun​(Runnable action)` |
    `CompletableFuture<Void>` | CompletableFuture.`thenRunAsync​(Runnable action)` |
    `CompletableFuture<Void>` | CompletableFuture.`thenRunAsync​(Runnable action, Executor executor)` |
    `CompletableFuture<T>` | CompletableFuture.`toCompletableFuture​()` | Returns this CompletableFuture.
    `CompletableFuture<T>` | CompletionStage.`toCompletableFuture​()` | Returns a `CompletableFuture` maintaining the same completion properties as this stage.
    `CompletableFuture<T>` | CompletableFuture.`whenComplete​(BiConsumer<? super T,? super Throwable> action)` |
    `CompletableFuture<T>` | CompletableFuture.`whenCompleteAsync​(BiConsumer<? super T,? super Throwable> action)` |
    `CompletableFuture<T>` | CompletableFuture.`whenCompleteAsync​(BiConsumer<? super T,? super Throwable> action, Executor executor)` |

    Methods in java.util.concurrent with parameters of type CompletableFuture
    Modifier and Type | Method | Description
    --- | --- | ---
    `static CompletableFuture<Void>` | CompletableFuture.`allOf​(CompletableFuture<?>... cfs)` | Returns a new CompletableFuture that is completed when all of the given CompletableFutures complete.
    `static CompletableFuture<Object>` | CompletableFuture.`anyOf​(CompletableFuture<?>... cfs)` | Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result.

  - ### Uses of CompletableFuture in jdk.incubator.http

    Methods in jdk.incubator.http that return CompletableFuture
    Modifier and Type | Method | Description
    --- | --- | ---
    `CompletableFuture<WebSocket>` | WebSocket.Builder.`buildAsync​()` | Builds a `WebSocket`.
    `CompletableFuture<U>` | HttpResponse.MultiProcessor.`completion​(CompletableFuture<Void> onComplete, CompletableFuture<Void> onFinalPushPromise)` | Returns a `CompletableFuture``<U>` which completes when the aggregate result object itself is available.
    `CompletableFuture<HttpResponse<V>>` | MultiMapResult.`get​(Object key)` |
    `CompletableFuture<HttpResponse<V>>` | MultiMapResult.`put​(HttpRequest key, CompletableFuture<HttpResponse<V>> value)` |
    `CompletableFuture<HttpResponse<V>>` | MultiMapResult.`remove​(Object key)` |
    `abstract <T> CompletableFuture<HttpResponse<T>>` | HttpClient.`sendAsync​(HttpRequest req, HttpResponse.BodyHandler<T> responseBodyHandler)` | Sends the given request asynchronously using this client and the given response handler.
    `abstract <U,T> CompletableFuture<U>` | HttpClient.`sendAsync​(HttpRequest req, HttpResponse.MultiProcessor<U,T> multiProcessor)` | Sends the given request asynchronously using this client and the given multi response handler.
    `CompletableFuture<WebSocket>` | WebSocket.`sendBinary​(ByteBuffer message, boolean isLast)` | Sends a Binary message with bytes from the given `ByteBuffer`.
    `CompletableFuture<WebSocket>` | WebSocket.`sendClose​(int statusCode, String reason)` | Sends a Close message with the given status code and the reason.
    `CompletableFuture<WebSocket>` | WebSocket.`sendPing​(ByteBuffer message)` | Sends a Ping message with bytes from the given ByteBuffer.
    `CompletableFuture<WebSocket>` | WebSocket.`sendPong​(ByteBuffer message)` | Sends a Pong message with bytes from the given ByteBuffer.
    `CompletableFuture<WebSocket>` | WebSocket.`sendText​(CharSequence message, boolean isLast)` | Sends a Text message with characters from the given `CharSequence`.
    `abstract CompletableFuture<HttpHeaders>` | HttpResponse.`trailers​()` | Returns the received response trailers, if there are any, when they become available.

    Methods in jdk.incubator.http that return types with arguments of type CompletableFuture
    Modifier and Type | Method | Description
    --- | --- | ---
    `Set<Map.Entry<HttpRequest,CompletableFuture<HttpResponse<V>>>>` | MultiMapResult.`entrySet​()` |
    `Collection<CompletableFuture<HttpResponse<V>>>` | MultiMapResult.`values​()` |

    Methods in jdk.incubator.http with parameters of type CompletableFuture
    Modifier and Type | Method | Description
    --- | --- | ---
    `CompletableFuture<U>` | HttpResponse.MultiProcessor.`completion​(CompletableFuture<Void> onComplete, CompletableFuture<Void> onFinalPushPromise)` | Returns a `CompletableFuture``<U>` which completes when the aggregate result object itself is available.
    `CompletableFuture<HttpResponse<V>>` | MultiMapResult.`put​(HttpRequest key, CompletableFuture<HttpResponse<V>> value)` |

    Method parameters in jdk.incubator.http with type arguments of type CompletableFuture
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | MultiMapResult.`putAll​(Map<? extends HttpRequest,? extends CompletableFuture<HttpResponse<V>>> m)` |