supplyAsync
SupplyAsync is a static factory method of the CompletableFuture class in java.util.concurrent. It creates a new CompletableFuture that will be completed when the provided Supplier finishes executing in another thread. The computation is started asynchronously by submitting the supplier to an Executor.
The variant supplyAsync(Supplier<U> supplier) uses the ForkJoinPool.commonPool() as the default executor, while supplyAsync(Supplier<U> supplier, Executor executor)
Use cases include starting asynchronous computations without managing threads directly, enabling non-blocking programming patterns. The method
Cancellation and error handling: The returned future can be canceled. If canceled before execution, the task
Origin and scope: Introduced in Java 8 as part of the CompletableFuture API, supplyAsync provides a concise