This chapter summarizes changes related to concurrency in Java 9.
CompletableFuture
Several new methods have been added to java.util.concurrent.CompletableFuture in Java 9.
Async
The CompletableFuture<T> completeAsync(Supplier<? extends T> supplier, Executor executor) and CompletableFuture<T> completeAsync(Supplier<? extends T> supplier) methods c
omplete
the CompletableFuture by using an asynchronous task to invoke the Supplier to get the result. The task is executed using the provided executor or the default executor. Listing 10-1 shows examples of how to use completeAsync().
final Long v1 = new CompletableFuture<Long>().completeAsync(() ...