diff --git a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java index 37a1c166..36610fec 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java @@ -133,84 +133,6 @@ public static CompletableFuture> mSupplyMostSuccessAsync( } - /** - * Returns a new CompletableFuture that is asynchronously completed - * by tasks running in the given Executor with the values obtained by calling the given Suppliers - * in the same order of the given Suppliers arguments. - *

- * This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier)} except for the most-success behavior. - * - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public static CompletableFuture> tupleMSupplyMostSuccessAsync( - Executor executor, long timeout, TimeUnit unit, Supplier supplier1, Supplier supplier2) { - requireNonNull(executor, "executor is null"); - requireNonNull(unit, "unit is null"); - Supplier[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2); - - return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers)); - } - - /** - * Returns a new CompletableFuture that is asynchronously completed - * by tasks running in the given Executor with the values obtained by calling the given Suppliers - * in the same order of the given Suppliers arguments. - *

- * This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier)} except for the most-success behavior. - * - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public static CompletableFuture> tupleMSupplyMostSuccessAsync( - Executor executor, long timeout, TimeUnit unit, Supplier supplier1, Supplier supplier2, Supplier supplier3) { - requireNonNull(executor, "executor is null"); - requireNonNull(unit, "unit is null"); - Supplier[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3); - - return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers)); - } - - - /** - * Returns a new CompletableFuture that is asynchronously completed - * by tasks running in the given Executor with the values obtained by calling the given Suppliers - * in the same order of the given Suppliers arguments. - *

- * This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier,Supplier)} except for the most-success behavior. - * - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public static CompletableFuture> tupleMSupplyMostSuccessAsync( - Executor executor, long timeout, TimeUnit unit, Supplier supplier1, Supplier supplier2, Supplier supplier3, Supplier supplier4) { - requireNonNull(executor, "executor is null"); - requireNonNull(unit, "unit is null"); - Supplier[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3,supplier4); - - return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers)); - } - - - /** - * Returns a new CompletableFuture that is asynchronously completed - * by tasks running in the given Executor with the values obtained by calling the given Suppliers - * in the same order of the given Suppliers arguments. - *

- * This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier,Supplier,Supplier)} except for the most-success behavior. - * - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public static CompletableFuture> tupleMSupplyMostSuccessAsync( - Executor executor, long timeout, TimeUnit unit, Supplier supplier1, Supplier supplier2, Supplier supplier3, Supplier supplier4, Supplier supplier5) { - requireNonNull(executor, "executor is null"); - requireNonNull(unit, "unit is null"); - Supplier[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3,supplier4,supplier5); - - return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers)); - } - /** * Returns a new CompletableFuture that is asynchronously completed @@ -640,6 +562,86 @@ public static CompletableFuture> return allTupleOf0(false, wrapSuppliers(executor, suppliers)); } + + /** + * Returns a new CompletableFuture that is asynchronously completed + * by tasks running in the given Executor with the values obtained by calling the given Suppliers + * in the same order of the given Suppliers arguments. + *

+ * This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier)} except for the most-success behavior. + * + * @param executor the executor to use for asynchronous execution + * @return the new CompletableFuture + */ + public static CompletableFuture> tupleMSupplyMostSuccessAsync( + Executor executor, long timeout, TimeUnit unit, Supplier supplier1, Supplier supplier2) { + requireNonNull(executor, "executor is null"); + requireNonNull(unit, "unit is null"); + Supplier[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2); + + return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers)); + } + + /** + * Returns a new CompletableFuture that is asynchronously completed + * by tasks running in the given Executor with the values obtained by calling the given Suppliers + * in the same order of the given Suppliers arguments. + *

+ * This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier)} except for the most-success behavior. + * + * @param executor the executor to use for asynchronous execution + * @return the new CompletableFuture + */ + public static CompletableFuture> tupleMSupplyMostSuccessAsync( + Executor executor, long timeout, TimeUnit unit, Supplier supplier1, Supplier supplier2, Supplier supplier3) { + requireNonNull(executor, "executor is null"); + requireNonNull(unit, "unit is null"); + Supplier[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3); + + return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers)); + } + + + /** + * Returns a new CompletableFuture that is asynchronously completed + * by tasks running in the given Executor with the values obtained by calling the given Suppliers + * in the same order of the given Suppliers arguments. + *

+ * This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier,Supplier)} except for the most-success behavior. + * + * @param executor the executor to use for asynchronous execution + * @return the new CompletableFuture + */ + public static CompletableFuture> tupleMSupplyMostSuccessAsync( + Executor executor, long timeout, TimeUnit unit, Supplier supplier1, Supplier supplier2, Supplier supplier3, Supplier supplier4) { + requireNonNull(executor, "executor is null"); + requireNonNull(unit, "unit is null"); + Supplier[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3,supplier4); + + return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers)); + } + + + /** + * Returns a new CompletableFuture that is asynchronously completed + * by tasks running in the given Executor with the values obtained by calling the given Suppliers + * in the same order of the given Suppliers arguments. + *

+ * This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier,Supplier,Supplier)} except for the most-success behavior. + * + * @param executor the executor to use for asynchronous execution + * @return the new CompletableFuture + */ + public static CompletableFuture> tupleMSupplyMostSuccessAsync( + Executor executor, long timeout, TimeUnit unit, Supplier supplier1, Supplier supplier2, Supplier supplier3, Supplier supplier4, Supplier supplier5) { + requireNonNull(executor, "executor is null"); + requireNonNull(unit, "unit is null"); + Supplier[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3,supplier4,supplier5); + + return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers)); + } + + // endregion //////////////////////////////////////////////////////////// // region## allOf* Methods(including mostResultsOfSuccess)