Class CompletableFutureUtils
CompletableFuture.- Author:
- Jerry Lee (oldratlee at gmail dot com)
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> CompletableFuture<Void> acceptEitherSuccess(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Consumer<? super T> action) Returns a new CompletableFuture that, when either given stage success, is executed with the corresponding result as argument to the supplied action.static <T> CompletableFuture<Void> acceptEitherSuccessAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Consumer<? super T> action) Returns a new CompletionStage that, when either given stage success, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied action.static <T> CompletableFuture<Void> acceptEitherSuccessAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Consumer<? super T> action, Executor executor) Returns a new CompletionStage that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied action.static CompletableFuture<Void> allOf(CompletionStage<?>... cfs) Returns a new CompletableFuture that is completed when all the given stages complete.static CompletableFuture<Void> allOfFastFail(CompletionStage<?>... cfs) Returns a new CompletableFuture that is successful when all the given CompletableFutures success, the results(CompletableFuture<Void>) of the given CompletableFutures are not reflected in the returned CompletableFuture, but may be obtained by inspecting them individually.static <T> CompletableFuture<List<T>> allResultsOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture with the results in the same order of all the given CompletableFutures, the new CompletableFuture is completed when all the given CompletableFutures complete.static <T> CompletableFuture<List<T>> allResultsOfFastFail(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture with the results in the same order of all the given CompletableFutures, the new CompletableFuture success when all the given CompletableFutures success.static <T1,T2> CompletableFuture <Tuple2<T1, T2>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Returns a new CompletableFuture that is completed when the given two CompletableFutures complete.static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Returns a new CompletableFuture that is completed when the given three CompletableFutures complete.static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Returns a new CompletableFuture that is completed when the given 4 CompletableFutures complete.static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Returns a new CompletableFuture that is completed when the given 5 CompletableFutures complete.static <T1,T2> CompletableFuture <Tuple2<T1, T2>> allTupleOfFastFail(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Returns a new CompletableFuture that is successful when the given two CompletableFutures success.static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> allTupleOfFastFail(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Returns a new CompletableFuture that is successful when the given three CompletableFutures success.static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> allTupleOfFastFail(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Returns a new CompletableFuture that is successful when the given 4 CompletableFutures success.static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> allTupleOfFastFail(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Returns a new CompletableFuture that is successful when the given 5 CompletableFutures success.static <T> CompletableFuture<T> anyOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed when any of the given CompletableFutures(stages) complete, with the same result.static <T> CompletableFuture<T> anyOfSuccess(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is successful when any of the given CompletableFutures success, with the same result.static <T,U> CompletableFuture <U> applyToEitherSuccess(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Function<? super T, ? extends U> fn) Returns a new CompletionStage that, when either given stage success, is executed with the corresponding result as argument to the supplied function.static <T,U> CompletableFuture <U> applyToEitherSuccessAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Function<? super T, ? extends U> fn) Returns a new CompletionStage that, when either given stage success, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied function.static <T,U> CompletableFuture <U> applyToEitherSuccessAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Function<? super T, ? extends U> fn, Executor executor) Returns a new CompletionStage that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied function.static <T> CompletableFuture<T>[]completableFutureListToArray(List<CompletableFuture<T>> cfList) A convenient util method for converting inputCompletableFuturelist to CompletableFuture array.static <T,C extends CompletableFuture<? super T>>
CcompleteAsync(C cf, Supplier<? extends T> supplier) Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor.static <T,C extends CompletableFuture<? super T>>
CcompleteAsync(C cf, Supplier<? extends T> supplier, Executor executor) Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor.static <T> CompletionStage<T> completedStage(T value) Returns a new CompletionStage that is already completed with the given value and supports only those methods in interfaceCompletionStage.static <T,C extends CompletableFuture<? super T>>
CcompleteOnTimeout(C cf, T value, long timeout, TimeUnit unit) Completes given CompletableFuture with the given value if not otherwise completed before the given timeout.static <T> CompletableFuture<T> copy(CompletableFuture<T> cf) Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally.static ExecutorReturns the default Executor used for async methods that do not specify an Executor.static ExecutordelayedExecutor(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).static ExecutordelayedExecutor(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).static <T> CompletableFuture<T> exceptionallyAsync(CompletableFuture<T> cf, Function<Throwable, ? extends T> fn) Returns a new CompletionStage that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using given stage's default asynchronous execution facility.static <T> CompletableFuture<T> exceptionallyAsync(CompletableFuture<T> cf, Function<Throwable, ? extends T> fn, Executor executor) Returns a new CompletionStage that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using the supplied Executor.static <T> CompletableFuture<T> exceptionallyCompose(CompletableFuture<T> cf, Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new CompletionStage that, when given stage completes exceptionally, is composed using the results of the supplied function applied to given stage's exception.static <T> CompletableFuture<T> exceptionallyComposeAsync(CompletableFuture<T> cf, Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new CompletionStage that, when given stage completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using given stage's default asynchronous execution facility.static <T> CompletableFuture<T> exceptionallyComposeAsync(CompletableFuture<T> cf, Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) Returns a new CompletionStage that, when given stage completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using the supplied Executor.static ThrowableexceptionNow(CompletableFuture<?> cf) Returns the exception thrown by the task, without waiting.static <T> CompletableFuture<T> Returns a new CompletableFuture that is already completed exceptionally with the given exception.static <T> CompletionStage<T> failedStage(Throwable ex) Returns a new CompletionStage that is already completed exceptionally with the given exception and supports only those methods in interfaceCompletionStage.static <T> Tjoin(CompletableFuture<T> cf, long timeout, TimeUnit unit) Waits if necessary for at most the given time for the computation to complete, and then retrieves its result value when complete, or throws an (unchecked) exception if completed exceptionally.static <T> CompletionStage<T> Returns a new CompletionStage that is completed normally with the same value as given CompletableFuture when it completes normally, and cannot be independently completed or otherwise used in ways not defined by the methods of interfaceCompletionStage.static <U> CompletableFuture<U> Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method.static <C extends CompletableFuture<?>>
CExceptionally completes given CompletableFuture with aTimeoutExceptionif not otherwise completed before the given timeout.static <T,C extends CompletionStage<? extends T>>
Cpeek(C cf, BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action when given stage completes, returns the given stage.static <T,C extends CompletionStage<? extends T>>
CpeekAsync(C cf, BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action when given stage completes, executes the given action using given stage's default asynchronous execution facility, returns the given stage.static <T,C extends CompletionStage<? extends T>>
CpeekAsync(C cf, BiConsumer<? super T, ? super Throwable> action, Executor executor) Peeks the result by executing the given action when given stage completes, executes the given action using the supplied Executor, returns the given stage.static <T> TresultNow(CompletableFuture<? extends T> cf) Returns the computed result, without waiting.static CompletableFuture<Void> runAfterBothFastFail(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action.static CompletableFuture<Void> runAfterBothFastFailAsync(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using CompletableFuture's default asynchronous execution facility.static CompletableFuture<Void> runAfterBothFastFailAsync(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action, Executor executor) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using the supplied executor.static CompletableFuture<Void> runAfterEitherSuccess(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action) Returns a new CompletableFuture that, when either given stage success, executes the given action.static CompletableFuture<Void> runAfterEitherSuccessAsync(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action) Returns a new CompletableFuture that, when either given stage success, executes the given action using CompletableFuture's default asynchronous execution facility.static CompletableFuture<Void> runAfterEitherSuccessAsync(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action, Executor executor) Returns a new CompletableFuture that, when either given stage success, executes the given action using the supplied executor.static CffuStatestate(CompletableFuture<?> cf) Returns the computation state(CffuState), this method is equivalent toCompletableFuture.state()with java version compatibility logic, so you can invoke in oldjava 18-.static <T,U> CompletableFuture <Void> thenAcceptBothFastFail(CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiConsumer<? super T, ? super U> action) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied action.static <T,U> CompletableFuture <Void> thenAcceptBothFastFailAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiConsumer<? super T, ? super U> action) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using CompletableFuture's default asynchronous execution facility, with the two results as arguments to the supplied action.static <T,U> CompletableFuture <Void> thenAcceptBothFastFailAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiConsumer<? super T, ? super U> action, Executor executor) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action.static <T,U, V> CompletableFuture <V> thenCombineFastFail(CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied function.static <T,U, V> CompletableFuture <V> thenCombineFastFailAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using CompletableFuture's default asynchronous execution facility, with the two results as arguments to the supplied function.static <T,U, V> CompletableFuture <V> thenCombineFastFailAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function.static <T> CompletableFuture<T>[]toCompletableFutureArray(CompletionStage<T>... stages) A convenient util method for converting inputCompletionStage(includingCffu/CompletableFuture) array element byCompletionStage.toCompletableFuture().
-
Method Details
-
allOf
Returns a new CompletableFuture that is completed when all the given stages complete. If any of the given stages 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 stages are not reflected in the returned CompletableFuture, but may be obtained by inspecting them individually. If no stages are provided, returns a CompletableFuture completed with the valuenull.if you need the results of given stages, prefer below methods:
allResultsOf(CompletionStage[])allTupleOf(CompletionStage, CompletionStage)/allTupleOf(CompletionStage, CompletionStage, CompletionStage, CompletionStage, CompletionStage)(provided overloaded methods with 2~5 input)
This method is the same as
CompletableFuture.allOf(CompletableFuture[]), except the parameter type is more generic(CompletionStage).- Parameters:
cfs- the stages- Returns:
- a new CompletableFuture that is completed when all the given stages complete
- Throws:
NullPointerException- if the array or any of its elements arenull
-
allResultsOf
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<List<T>> allResultsOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture with the results in the same order of all the given CompletableFutures, the new CompletableFuture is completed when all 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. If no CompletableFutures are provided, returns a CompletableFuture completed with the value empty list.This method is the same as
CompletableFuture.allOf(CompletableFuture[]), except the returned CompletableFuture contains the results of the given CompletableFutures.- Parameters:
cfs- the CompletableFutures- Returns:
- a new CompletableFuture that is completed when all the given CompletableFutures complete
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
allOfFastFail
Returns a new CompletableFuture that is successful when all the given CompletableFutures success, the results(CompletableFuture<Void>) of the given CompletableFutures are not reflected in the returned CompletableFuture, but may be obtained by inspecting them individually. If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletableFutures, with a CompletionException holding this exception as its cause. If no CompletableFutures are provided, returns a CompletableFuture completed with the valuenull.This method is the same as
CompletableFuture.allOf(CompletableFuture[])except for the fast-fail behavior.- Parameters:
cfs- the CompletableFutures- Returns:
- a new CompletableFuture that is successful when all the given CompletableFutures success
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
allResultsOfFastFail
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<List<T>> allResultsOfFastFail(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture with the results in the same order of all the given CompletableFutures, the new CompletableFuture success when all the given CompletableFutures success. If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletableFutures, with a CompletionException holding this exception as its cause. If no CompletableFutures are provided, returns a CompletableFuture completed with the value empty list.This method is the same as
allOfFastFail(CompletionStage[]), except the returned CompletableFuture contains the results of the given CompletableFutures.This method is the same as
allResultsOf(CompletionStage[])except for the fast-fail behavior.- Parameters:
cfs- the CompletableFutures- Returns:
- a new CompletableFuture that is successful when all the given CompletableFutures success
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
anyOf
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<T> anyOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed when any of the given CompletableFutures(stages) 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.This method is the same as
CompletableFuture.anyOf(CompletableFuture[]), except the parameter type is more generic typeCompletionStage. and the return result type is generic type instead ofObject.- Parameters:
cfs- the CompletableFutures- Returns:
- a new CompletableFuture that is completed with the result or exception from any of the given CompletableFutures when one completes
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
anyOfSuccess
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<T> anyOfSuccess(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is successful when any of the given CompletableFutures success, with the same result. Otherwise, all the given CompletableFutures complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletableFutures as its cause. If no CompletableFutures are provided, returns a new CompletableFuture that is already completed exceptionally with a CompletionException holding aNoCfsProvidedExceptionas its cause.This method is the same as
anyOf(CompletionStage[])except for the any-success behavior(not any-complete).- Parameters:
cfs- the CompletableFutures- Returns:
- a new CompletableFuture that is successful when any of the given CompletableFutures success, with the same result
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
allTupleOf
@Contract(pure=true) public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Returns a new CompletableFuture that is completed when the given two 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.- Returns:
- a new CompletableFuture that is completed when the given 2 CompletableFutures complete
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
allTupleOfFastFail
@Contract(pure=true) public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> allTupleOfFastFail(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Returns a new CompletableFuture that is successful when the given two CompletableFutures success. If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletableFutures, with a CompletionException holding this exception as its cause.This method is the same as
allTupleOf(CompletionStage, CompletionStage)except for the fast-fail behavior.- Returns:
- a new CompletableFuture that is successful when the given two CompletableFutures success
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
allTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, allTupleOfT3>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Returns a new CompletableFuture that is completed when the given three 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.- Returns:
- a new CompletableFuture that is completed when the given 3 CompletableFutures complete
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
allTupleOfFastFail
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, allTupleOfFastFailT3>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Returns a new CompletableFuture that is successful when the given three CompletableFutures success. If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletableFutures, with a CompletionException holding this exception as its cause.This method is the same as
allTupleOf(CompletionStage, CompletionStage, CompletionStage)except for the fast-fail behavior.- Returns:
- a new CompletableFuture that is successful when the given three CompletableFutures success
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
allTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, allTupleOfT3, T4>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Returns a new CompletableFuture that is completed when the given 4 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.- Returns:
- a new CompletableFuture that is completed when the given 4 CompletableFutures complete
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
allTupleOfFastFail
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, allTupleOfFastFailT3, T4>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Returns a new CompletableFuture that is successful when the given 4 CompletableFutures success. If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletableFutures, with a CompletionException holding this exception as its cause.This method is the same as
allTupleOf(CompletionStage, CompletionStage, CompletionStage, CompletionStage)except for the fast-fail behavior.- Returns:
- a new CompletableFuture that is successful when the given 4 CompletableFutures success
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
allTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, allTupleOfT3, T4, T5>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Returns a new CompletableFuture that is completed when the given 5 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.- Returns:
- a new CompletableFuture that is completed when the given 5 CompletableFutures complete
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
allTupleOfFastFail
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, allTupleOfFastFailT3, T4, T5>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Returns a new CompletableFuture that is successful when the given 5 CompletableFutures success. If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletableFutures, with a CompletionException holding this exception as its cause.This method is the same as
allTupleOf(CompletionStage, CompletionStage, CompletionStage, CompletionStage, CompletionStage)except for the fast-fail behavior.- Returns:
- a new CompletableFuture that is successful when the given 5 CompletableFutures success
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
runAfterBothFastFail
public static CompletableFuture<Void> runAfterBothFastFail(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.This method is the same as
CompletionStage.runAfterBoth(CompletionStage, Runnable)except for the fast-fail behavior.- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
runAfterBothFastFailAsync
public static CompletableFuture<Void> runAfterBothFastFailAsync(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using CompletableFuture's default asynchronous execution facility. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.This method is the same as
CompletionStage.runAfterBothAsync(CompletionStage, Runnable)except for the fast-fail behavior.- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
runAfterBothFastFailAsync
public static CompletableFuture<Void> runAfterBothFastFailAsync(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action, Executor executor) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using the supplied executor. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.This method is the same as
CompletionStage.runAfterBothAsync(CompletionStage, Runnable, Executor)except for the fast-fail behavior.- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
thenAcceptBothFastFail
public static <T,U> CompletableFuture<Void> thenAcceptBothFastFail(CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiConsumer<? super T, ? super U> action) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.This method is the same as
CompletionStage.thenAcceptBoth(CompletionStage, BiConsumer)except for the fast-fail behavior.- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
thenAcceptBothFastFailAsync
public static <T,U> CompletableFuture<Void> thenAcceptBothFastFailAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiConsumer<? super T, ? super U> action) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using CompletableFuture's default asynchronous execution facility, with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.This method is the same as
CompletionStage.thenAcceptBothAsync(CompletionStage, BiConsumer)except for the fast-fail behavior.- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
thenAcceptBothFastFailAsync
public static <T,U> CompletableFuture<Void> thenAcceptBothFastFailAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiConsumer<? super T, ? super U> action, Executor executor) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.This method is the same as
CompletionStage.thenAcceptBothAsync(CompletionStage, BiConsumer, Executor)except for the fast-fail behavior.- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
thenCombineFastFail
public static <T,U, CompletableFuture<V> thenCombineFastFailV> (CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.This method is the same as
CompletionStage.thenCombine(CompletionStage, BiFunction)except for the fast-fail behavior.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
thenCombineFastFailAsync
public static <T,U, CompletableFuture<V> thenCombineFastFailAsyncV> (CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using CompletableFuture's default asynchronous execution facility, with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.This method is the same as
CompletionStage.thenCombineAsync(CompletionStage, BiFunction)except for the fast-fail behavior.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
thenCombineFastFailAsync
public static <T,U, CompletableFuture<V> thenCombineFastFailAsyncV> (CompletionStage<? extends T> cf1, CompletionStage<? extends U> cf2, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.This method is the same as
CompletionStage.thenCombineAsync(CompletionStage, BiFunction, Executor)except for the fast-fail behavior.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
runAfterEitherSuccess
public static CompletableFuture<Void> runAfterEitherSuccess(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action) Returns a new CompletableFuture that, when either given stage success, executes the given action. Otherwise, all two given CompletionStage complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletionStage as its cause.This method is the same as
CompletableFuture.runAfterEither(CompletionStage, Runnable)except for the either-success behavior(not either-complete).- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
runAfterEitherSuccessAsync
public static CompletableFuture<Void> runAfterEitherSuccessAsync(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action) Returns a new CompletableFuture that, when either given stage success, executes the given action using CompletableFuture's default asynchronous execution facility. Otherwise, all two given CompletionStage complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletionStage as its cause.This method is the same as
CompletionStage.runAfterEitherAsync(CompletionStage, Runnable)except for the either-success behavior(not either-complete).- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
runAfterEitherSuccessAsync
public static CompletableFuture<Void> runAfterEitherSuccessAsync(CompletionStage<?> cf1, CompletionStage<?> cf2, Runnable action, Executor executor) Returns a new CompletableFuture that, when either given stage success, executes the given action using the supplied executor. Otherwise, all two given CompletionStage complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletionStage as its cause.This method is the same as
CompletionStage.runAfterEitherAsync(CompletionStage, Runnable, Executor)except for the either-success behavior(not either-complete).- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
acceptEitherSuccess
public static <T> CompletableFuture<Void> acceptEitherSuccess(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Consumer<? super T> action) Returns a new CompletableFuture that, when either given stage success, is executed with the corresponding result as argument to the supplied action.This method is the same as
CompletionStage.acceptEither(CompletionStage, Consumer)except for the either-success behavior(not either-complete).- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
acceptEitherSuccessAsync
public static <T> CompletableFuture<Void> acceptEitherSuccessAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Consumer<? super T> action) Returns a new CompletionStage that, when either given stage success, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied action.This method is the same as
CompletionStage.acceptEitherAsync(CompletionStage, Consumer)except for the either-success behavior(not either-complete).- Parameters:
action- the action to perform before completing the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
acceptEitherSuccessAsync
public static <T> CompletableFuture<Void> acceptEitherSuccessAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Consumer<? super T> action, Executor executor) Returns a new CompletionStage that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied action.This method is the same as
CompletionStage.acceptEitherAsync(CompletionStage, Consumer, Executor)except for the either-success behavior(not either-complete).- Parameters:
action- the action to perform before completing the returned CompletableFutureexecutor- the executor to use for asynchronous execution- Returns:
- the new CompletableFuture
- See Also:
-
applyToEitherSuccess
public static <T,U> CompletableFuture<U> applyToEitherSuccess(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Function<? super T, ? extends U> fn) Returns a new CompletionStage that, when either given stage success, is executed with the corresponding result as argument to the supplied function.This method is the same as
CompletionStage.applyToEither(CompletionStage, Function)except for the either-success behavior(not either-complete).- Type Parameters:
U- the function's return type- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
applyToEitherSuccessAsync
public static <T,U> CompletableFuture<U> applyToEitherSuccessAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Function<? super T, ? extends U> fn) Returns a new CompletionStage that, when either given stage success, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied function.This method is the same as
CompletionStage.applyToEitherAsync(CompletionStage, Function)except for the either-success behavior(not either-complete).- Type Parameters:
U- the function's return type- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture- Returns:
- the new CompletableFuture
- See Also:
-
applyToEitherSuccessAsync
public static <T,U> CompletableFuture<U> applyToEitherSuccessAsync(CompletionStage<? extends T> cf1, CompletionStage<? extends T> cf2, Function<? super T, ? extends U> fn, Executor executor) Returns a new CompletionStage that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied function.This method is the same as
CompletionStage.applyToEitherAsync(CompletionStage, Function, Executor)except for the either-success behavior(not either-complete).- Type Parameters:
U- the function's return type- Parameters:
fn- the function to use to compute the value of the returned CompletableFutureexecutor- the executor to use for asynchronous execution- Returns:
- the new CompletableFuture
- See Also:
-
peek
public static <T,C extends CompletionStage<? extends T>> C peek(C cf, BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action when given stage completes, returns the given stage.When the given stage is complete, the given action is invoked with the result (or
nullif none) and the exception (ornullif none) of given stage as arguments. Whether the supplied action throws an exception or not, do NOT affect this cffu.Unlike method
handleand like methodwhenComplete, this method is not designed to translate completion outcomes.- Parameters:
action- the action to perform- Returns:
- the given stage
- See Also:
-
peekAsync
public static <T,C extends CompletionStage<? extends T>> C peekAsync(C cf, BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action when given stage completes, executes the given action using given stage's default asynchronous execution facility, returns the given stage.When the given stage is complete, the given action is invoked with the result (or
nullif none) and the exception (ornullif none) of given stage as arguments. Whether the supplied action throws an exception or not, do NOT affect this cffu.Unlike method
handleand like methodwhenComplete, this method is not designed to translate completion outcomes.- Parameters:
action- the action to perform- Returns:
- the given stage
- See Also:
-
peekAsync
public static <T,C extends CompletionStage<? extends T>> C peekAsync(C cf, BiConsumer<? super T, ? super Throwable> action, Executor executor) Peeks the result by executing the given action when given stage completes, executes the given action using the supplied Executor, returns the given stage.When the given stage is complete, the given action is invoked with the result (or
nullif none) and the exception (ornullif none) of given stage as arguments. Whether the supplied action throws an exception or not, do NOT affect this cffu.Unlike method
handleand like methodwhenComplete, this method is not designed to translate completion outcomes.- Parameters:
action- the action to perform- Returns:
- the given stage
- See Also:
-
failedFuture
Returns a new CompletableFuture that is already completed exceptionally with the given exception.- Type Parameters:
T- the type of the value- Parameters:
ex- the exception- Returns:
- the exceptionally completed CompletableFuture
-
completedStage
Returns a new CompletionStage that is already completed with the given value and supports only those methods in interfaceCompletionStage.CAUTION:
if run on old Java 8, just return a *normal* CompletableFuture which is NOT with a *minimal* CompletionStage.- Type Parameters:
T- the type of the value- Parameters:
value- the value- Returns:
- the completed CompletionStage
-
failedStage
Returns a new CompletionStage that is already completed exceptionally with the given exception and supports only those methods in interfaceCompletionStage.CAUTION:
if run on old Java 8, just return a *normal* CompletableFuture which is NOT with a *minimal* CompletionStage.- Type Parameters:
T- the type of the value- Parameters:
ex- the exception- Returns:
- the exceptionally completed CompletionStage
-
delayedExecutor
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'sexecutemethod.- Parameters:
delay- how long to delay, in units ofunitunit- aTimeUnitdetermining how to interpret thedelayparameter- Returns:
- the new delayed executor
-
delayedExecutor
@Contract(pure=true) 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'sexecutemethod.- Parameters:
delay- how long to delay, in units ofunitunit- aTimeUnitdetermining how to interpret thedelayparameterexecutor- the base executor- Returns:
- the new delayed executor
-
exceptionallyAsync
public static <T> CompletableFuture<T> exceptionallyAsync(CompletableFuture<T> cf, Function<Throwable, ? extends T> fn) Returns a new CompletionStage that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using given stage's default asynchronous execution facility. Otherwise, if given stage completes normally, then the returned stage also completes normally with the same value.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture if given CompletionStage completed exceptionally- Returns:
- the new CompletableFuture
-
exceptionallyAsync
public static <T> CompletableFuture<T> exceptionallyAsync(CompletableFuture<T> cf, Function<Throwable, ? extends T> fn, Executor executor) Returns a new CompletionStage that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using the supplied Executor. Otherwise, if given stage completes normally, then the returned stage also completes normally with the same value.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture if given CompletionStage completed exceptionallyexecutor- the executor to use for asynchronous execution- Returns:
- the new CompletableFuture
-
orTimeout
Exceptionally completes given CompletableFuture with aTimeoutExceptionif not otherwise completed before the given timeout.- Parameters:
timeout- how long to wait before completing exceptionally with a TimeoutException, in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameter- Returns:
- given CompletableFuture
-
completeOnTimeout
public static <T,C extends CompletableFuture<? super T>> C completeOnTimeout(C cf, @Nullable T value, long timeout, TimeUnit unit) Completes given CompletableFuture with the given value if not otherwise completed before the given timeout.- Parameters:
value- the value to use upon timeouttimeout- how long to wait before completing normally with the given value, in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameter- Returns:
- given CompletableFuture
-
exceptionallyCompose
public static <T> CompletableFuture<T> exceptionallyCompose(CompletableFuture<T> cf, Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new CompletionStage that, when given stage completes exceptionally, is composed using the results of the supplied function applied to given stage's exception.- Parameters:
fn- the function to use to compute the returned CompletableFuture if given CompletionStage completed exceptionally- Returns:
- the new CompletableFuture
-
exceptionallyComposeAsync
public static <T> CompletableFuture<T> exceptionallyComposeAsync(CompletableFuture<T> cf, Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new CompletionStage that, when given stage completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using given stage's default asynchronous execution facility.- Parameters:
fn- the function to use to compute the returned CompletableFuture if given CompletionStage completed exceptionally- Returns:
- the new CompletableFuture
-
exceptionallyComposeAsync
public static <T> CompletableFuture<T> exceptionallyComposeAsync(CompletableFuture<T> cf, Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) Returns a new CompletionStage that, when given stage completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using the supplied Executor.- Parameters:
fn- the function to use to compute the returned CompletableFuture if given CompletionStage completed exceptionallyexecutor- the executor to use for asynchronous execution- Returns:
- the new CompletableFuture
-
join
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result value when complete, or throws an (unchecked) exception if completed exceptionally.NOTE:
Calling this methodresult = CompletableFutureUtils.join(cf, timeout, unit);is the same as:
CAUTION:result = cf.copy() // defensive copy to avoid writing this cf unexpectedly .orTimeout(timeout, unit) .join();
if the wait timed out, this method throws an (unchecked)CompletionExceptionwith theTimeoutExceptionas its cause; NOT throws a (checked)TimeoutExceptionlikeCompletableFuture.get(long, TimeUnit).- Parameters:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
- the result value
- Throws:
CancellationException- if the computation was cancelledCompletionException- if given future completed exceptionally or a completion computation threw an exception or the wait timed out(with theTimeoutExceptionas its cause)- See Also:
-
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.
results = futures.stream() .filter(f -> f.state() == Future.State.SUCCESS) .map(Future::resultNow) .toList(); -
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.
- Returns:
- the exception thrown by the task
- Throws:
IllegalStateException- if the task has not completed, the task completed normally, or the task was cancelled- See Also:
-
state
Returns the computation state(CffuState), this method is equivalent toCompletableFuture.state()with java version compatibility logic, so you can invoke in oldjava 18-.- Returns:
- the computation state
- See Also:
-
completeAsync
public static <T,C extends CompletableFuture<? super T>> C completeAsync(C cf, Supplier<? extends T> supplier) Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor.- Parameters:
supplier- a function returning the value to be used to complete given CompletableFuture- Returns:
- given CompletableFuture
-
completeAsync
public static <T,C extends CompletableFuture<? super T>> C completeAsync(C cf, Supplier<? extends T> supplier, Executor executor) Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor.- Parameters:
supplier- a function returning the value to be used to complete given CompletableFutureexecutor- the executor to use for asynchronous execution- Returns:
- given CompletableFuture
-
minimalCompletionStage
@Contract(pure=true) public static <T> CompletionStage<T> minimalCompletionStage(CompletableFuture<T> cf) Returns a new CompletionStage that is completed normally with the same value as given CompletableFuture when it completes normally, and cannot be independently completed or otherwise used in ways not defined by the methods of interfaceCompletionStage. If given CompletableFuture completes exceptionally, then the returned CompletionStage completes exceptionally with a CompletionException with given exception as cause.CAUTION:
if run on old Java 8, just return a *normal* CompletableFuture which is NOT with a *minimal* CompletionStage.- Returns:
- the new CompletionStage
-
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 tothenApply(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.- Returns:
- the new CompletableFuture
-
newIncompleteFuture
@Contract(pure=true) public static <U> CompletableFuture<U> newIncompleteFuture(CompletableFuture<?> cf) Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method.- Type Parameters:
U- the type of the value- Returns:
- a new CompletableFuture
-
defaultExecutor
Returns the default Executor used for async methods that do not specify an Executor. This class uses theForkJoinPool.commonPool()if it supports more than one parallel thread, or else an Executor using one thread per async task.
CAUTION: This executor may be not suitable for common biz use(io intensive).- Returns:
- the executor
-
toCompletableFutureArray
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<T>[] toCompletableFutureArray(CompletionStage<T>... stages) A convenient util method for converting inputCompletionStage(includingCffu/CompletableFuture) array element byCompletionStage.toCompletableFuture().- See Also:
-
completableFutureListToArray
@Contract(pure=true) public static <T> CompletableFuture<T>[] completableFutureListToArray(List<CompletableFuture<T>> cfList) A convenient util method for converting inputCompletableFuturelist to CompletableFuture array.- See Also:
-