Class CompletableFutureKit
java.lang.Object
com.iohao.net.common.kit.CompletableFutureKit
CompletableFuture Kit.
see CompletableFuture
- Author:
- 渔民小镇
- date:
- 2022-07-27
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<T> sequence(CompletableFuture<T>[] futures) Executes multiple CompletableFuture tasks in parallel and waits for their results.static <T> List<T> sequence(List<CompletableFuture<T>> futures) Executes multiple CompletableFuture tasks in parallel and waits for their results.static <U> CompletableFuture<List<U>> sequenceAsync(List<CompletableFuture<U>> futures) Executes multiple CompletableFuture tasks in parallel and returns a new CompletableFuture that will be completed when all tasks are done.
-
Method Details
-
sequence
Executes multiple CompletableFuture tasks in parallel and waits for their results.- Type Parameters:
T- The type of the result.- Parameters:
futures- A list of CompletableFuture tasks.- Returns:
- A list containing the results of all completed futures.
-
sequence
Executes multiple CompletableFuture tasks in parallel and waits for their results.- Type Parameters:
T- The type of the result.- Parameters:
futures- array of CompletableFuture tasks.- Returns:
- A list containing the results of all completed futures.
-
sequenceAsync
Executes multiple CompletableFuture tasks in parallel and returns a new CompletableFuture that will be completed when all tasks are done.- Type Parameters:
U- The type of the result.- Parameters:
futures- A list of CompletableFuture tasks.- Returns:
- A CompletableFuture that will complete with a list of results.
-