From 7fa70350f02a7190850fd4019ed9363da51448d3 Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Sat, 22 Jun 2024 20:34:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20reorder=20methods=20`allTupleOf*`?= =?UTF-8?q?=20methods,=20consistent=20with=20other=20methods=20?= =?UTF-8?q?=F0=9F=92=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/foldright/cffu/CffuFactory.java | 92 +++++++++---------- .../cffu/CompletableFutureUtils.java | 92 +++++++++---------- 2 files changed, 92 insertions(+), 92 deletions(-) diff --git a/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java b/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java index 46f1eabd..67c4b806 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java @@ -541,21 +541,6 @@ public Cffu> allTupleOfFastFail( return create(CompletableFutureUtils.allTupleOfFastFail(cf1, cf2)); } - /** - * Returns a new Cffu that is completed when the given two stages complete. - * If any of the given stages complete exceptionally, then the returned Cffu also does so, - * with a CompletionException holding this exception as its cause. - * - * @return a new Cffu that is completed when the given two stages complete - * @throws NullPointerException if any of the given stages are {@code null} - * @see #allResultsOf(CompletionStage[]) - */ - @Contract(pure = true) - public Cffu> allTupleOf( - CompletionStage cf1, CompletionStage cf2) { - return create(CompletableFutureUtils.allTupleOf(cf1, cf2)); - } - /** * Returns a new Cffu that is successful when the given three stages success. * If any of the given stages complete exceptionally, then the returned Cffu also does so @@ -574,21 +559,6 @@ public Cffu> allTupleOfFastFail( return create(CompletableFutureUtils.allTupleOfFastFail(cf1, cf2, cf3)); } - /** - * Returns a new Cffu that is completed when the given three stages complete. - * If any of the given stages complete exceptionally, then the returned Cffu also does so, - * with a CompletionException holding this exception as its cause. - * - * @return a new Cffu that is completed when the given three stages complete - * @throws NullPointerException if any of the given stages are {@code null} - * @see #allResultsOf(CompletionStage[]) - */ - @Contract(pure = true) - public Cffu> allTupleOf( - CompletionStage cf1, CompletionStage cf2, CompletionStage cf3) { - return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3)); - } - /** * Returns a new Cffu that is successful when the given four stages success. * If any of the given stages complete exceptionally, then the returned Cffu also does so @@ -608,22 +578,6 @@ public Cffu> allTupleOfFastFail( return create(CompletableFutureUtils.allTupleOfFastFail(cf1, cf2, cf3, cf4)); } - /** - * Returns a new Cffu that is completed when the given four stages complete. - * If any of the given stages complete exceptionally, then the returned Cffu also does so, - * with a CompletionException holding this exception as its cause. - * - * @return a new Cffu that is completed when the given four stages complete - * @throws NullPointerException if any of the given stages are {@code null} - * @see #allResultsOf(CompletionStage[]) - */ - @Contract(pure = true) - public Cffu> allTupleOf( - CompletionStage cf1, CompletionStage cf2, - CompletionStage cf3, CompletionStage cf4) { - return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3, cf4)); - } - /** * Returns a new Cffu that is successful when the given five stages success. * If any of the given stages complete exceptionally, then the returned Cffu also does so @@ -643,6 +597,52 @@ public Cffu> allTupleOfFastFail( return create(CompletableFutureUtils.allTupleOfFastFail(cf1, cf2, cf3, cf4, cf5)); } + /** + * Returns a new Cffu that is completed when the given two stages complete. + * If any of the given stages complete exceptionally, then the returned Cffu also does so, + * with a CompletionException holding this exception as its cause. + * + * @return a new Cffu that is completed when the given two stages complete + * @throws NullPointerException if any of the given stages are {@code null} + * @see #allResultsOf(CompletionStage[]) + */ + @Contract(pure = true) + public Cffu> allTupleOf( + CompletionStage cf1, CompletionStage cf2) { + return create(CompletableFutureUtils.allTupleOf(cf1, cf2)); + } + + /** + * Returns a new Cffu that is completed when the given three stages complete. + * If any of the given stages complete exceptionally, then the returned Cffu also does so, + * with a CompletionException holding this exception as its cause. + * + * @return a new Cffu that is completed when the given three stages complete + * @throws NullPointerException if any of the given stages are {@code null} + * @see #allResultsOf(CompletionStage[]) + */ + @Contract(pure = true) + public Cffu> allTupleOf( + CompletionStage cf1, CompletionStage cf2, CompletionStage cf3) { + return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3)); + } + + /** + * Returns a new Cffu that is completed when the given four stages complete. + * If any of the given stages complete exceptionally, then the returned Cffu also does so, + * with a CompletionException holding this exception as its cause. + * + * @return a new Cffu that is completed when the given four stages complete + * @throws NullPointerException if any of the given stages are {@code null} + * @see #allResultsOf(CompletionStage[]) + */ + @Contract(pure = true) + public Cffu> allTupleOf( + CompletionStage cf1, CompletionStage cf2, + CompletionStage cf3, CompletionStage cf4) { + return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3, cf4)); + } + /** * Returns a new Cffu that is completed when the given five stages complete. * If any of the given stages complete exceptionally, then the returned Cffu also does so, 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 6a782572..06a05a78 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java @@ -1088,21 +1088,6 @@ public static CompletableFuture> allTupleOfFastFail( return allTupleOf0(true, requireCfsAndEleNonNull(cf1, cf2)); } - /** - * Returns a new CompletableFuture that is completed when the given two 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. - * - * @return a new CompletableFuture that is completed when the given two stages complete - * @throws NullPointerException if any of the given stages are {@code null} - * @see #allResultsOf(CompletionStage[]) - */ - @Contract(pure = true) - public static CompletableFuture> allTupleOf( - CompletionStage cf1, CompletionStage cf2) { - return allTupleOf0(false, requireCfsAndEleNonNull(cf1, cf2)); - } - /** * Returns a new CompletableFuture that is successful when the given three stages success. * If any of the given stages complete exceptionally, then the returned CompletableFuture also does so @@ -1121,21 +1106,6 @@ public static CompletableFuture> allTupleOfFastF return allTupleOf0(true, requireCfsAndEleNonNull(cf1, cf2, cf3)); } - /** - * Returns a new CompletableFuture that is completed when the given three 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. - * - * @return a new CompletableFuture that is completed when the given three stages complete - * @throws NullPointerException if any of the given stages are {@code null} - * @see #allResultsOf(CompletionStage[]) - */ - @Contract(pure = true) - public static CompletableFuture> allTupleOf( - CompletionStage cf1, CompletionStage cf2, CompletionStage cf3) { - return allTupleOf0(false, requireCfsAndEleNonNull(cf1, cf2, cf3)); - } - /** * Returns a new CompletableFuture that is successful when the given four stages success. * If any of the given stages complete exceptionally, then the returned CompletableFuture also does so @@ -1155,22 +1125,6 @@ public static CompletableFuture> allTupl return allTupleOf0(true, requireCfsAndEleNonNull(cf1, cf2, cf3, cf4)); } - /** - * Returns a new CompletableFuture that is completed when the given four 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. - * - * @return a new CompletableFuture that is completed when the given four stages complete - * @throws NullPointerException if any of the given stages are {@code null} - * @see #allResultsOf(CompletionStage[]) - */ - @Contract(pure = true) - public static CompletableFuture> allTupleOf( - CompletionStage cf1, CompletionStage cf2, - CompletionStage cf3, CompletionStage cf4) { - return allTupleOf0(false, requireCfsAndEleNonNull(cf1, cf2, cf3, cf4)); - } - /** * Returns a new CompletableFuture that is successful when the given five stages success. * If any of the given stages complete exceptionally, then the returned CompletableFuture also does so @@ -1190,6 +1144,52 @@ public static CompletableFuture> return allTupleOf0(true, requireCfsAndEleNonNull(cf1, cf2, cf3, cf4, cf5)); } + /** + * Returns a new CompletableFuture that is completed when the given two 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. + * + * @return a new CompletableFuture that is completed when the given two stages complete + * @throws NullPointerException if any of the given stages are {@code null} + * @see #allResultsOf(CompletionStage[]) + */ + @Contract(pure = true) + public static CompletableFuture> allTupleOf( + CompletionStage cf1, CompletionStage cf2) { + return allTupleOf0(false, requireCfsAndEleNonNull(cf1, cf2)); + } + + /** + * Returns a new CompletableFuture that is completed when the given three 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. + * + * @return a new CompletableFuture that is completed when the given three stages complete + * @throws NullPointerException if any of the given stages are {@code null} + * @see #allResultsOf(CompletionStage[]) + */ + @Contract(pure = true) + public static CompletableFuture> allTupleOf( + CompletionStage cf1, CompletionStage cf2, CompletionStage cf3) { + return allTupleOf0(false, requireCfsAndEleNonNull(cf1, cf2, cf3)); + } + + /** + * Returns a new CompletableFuture that is completed when the given four 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. + * + * @return a new CompletableFuture that is completed when the given four stages complete + * @throws NullPointerException if any of the given stages are {@code null} + * @see #allResultsOf(CompletionStage[]) + */ + @Contract(pure = true) + public static CompletableFuture> allTupleOf( + CompletionStage cf1, CompletionStage cf2, + CompletionStage cf3, CompletionStage cf4) { + return allTupleOf0(false, requireCfsAndEleNonNull(cf1, cf2, cf3, cf4)); + } + /** * Returns a new CompletableFuture that is completed when the given five stages complete. * If any of the given stages complete exceptionally, then the returned CompletableFuture also does so,