diff --git a/src/main/java/io/foldright/cffu/CffuFactory.java b/src/main/java/io/foldright/cffu/CffuFactory.java index 6f8b026e..ef4e6e27 100644 --- a/src/main/java/io/foldright/cffu/CffuFactory.java +++ b/src/main/java/io/foldright/cffu/CffuFactory.java @@ -449,7 +449,7 @@ public Cffu anyOf() { * the returned Cffu also does so, with a CompletionException holding * an exception from any of the given Cffu as its cause. If no Cffu are provided, * returns a new Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * with a CompletionException holding a {@link NoCfsProvidedException} as its cause. * * @param cfs the Cffus * @return a new Cffu @@ -467,7 +467,7 @@ public Cffu anyOfSuccess(Cffu... cfs) { * the returned Cffu 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 Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * with a CompletionException holding a {@link NoCfsProvidedException} as its cause. * * @param cfs the CompletableFutures * @return a new Cffu @@ -649,7 +649,7 @@ public Cffu cffuAnyOf() { * the returned Cffu also does so, with a CompletionException holding * an exception from any of the given Cffu as its cause. If no Cffu are provided, * returns a new Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * with a CompletionException holding a {@link NoCfsProvidedException} as its cause. * * @param cfs the Cffus * @return a new Cffu @@ -667,7 +667,7 @@ public final Cffu cffuAnyOfSuccess(Cffu... cfs) { * the returned Cffu 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 Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * with a CompletionException holding a {@link NoCfsProvidedException} as its cause. * * @param cfs the CompletableFutures * @return a new Cffu diff --git a/src/main/java/io/foldright/cffu/CompletableFutureUtils.java b/src/main/java/io/foldright/cffu/CompletableFutureUtils.java index fb15aa3c..7197d9ab 100644 --- a/src/main/java/io/foldright/cffu/CompletableFutureUtils.java +++ b/src/main/java/io/foldright/cffu/CompletableFutureUtils.java @@ -25,6 +25,10 @@ @ParametersAreNonnullByDefault @ReturnValuesAreNonnullByDefault public final class CompletableFutureUtils { + //////////////////////////////////////////////////////////////////////////////// + //# allOf* methods + //////////////////////////////////////////////////////////////////////////////// + /** * Returns a new CompletableFuture with the result of all the given CompletableFutures, * the new CompletableFuture is completed when all the given CompletableFutures complete. @@ -163,6 +167,10 @@ private static void fill(CompletableFuture[] cfs, } } + //////////////////////////////////////////////////////////////////////////////// + //# anyOf* methods + //////////////////////////////////////////////////////////////////////////////// + /** * Returns a new CompletableFuture that is completed * when any of the given CompletableFutures complete, with the same result. @@ -190,7 +198,7 @@ public static CompletableFuture anyOfWithType(CompletableFuture... cfs * 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 a {@link NoCfsProvidedException} exception as its cause. + * with a CompletionException holding a {@link NoCfsProvidedException} as its cause. * * @param cfs the CompletableFutures * @return a new CompletableFuture that success @@ -224,7 +232,7 @@ public static CompletableFuture anyOfSuccess(CompletableFuture... cfs * 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 a {@link NoCfsProvidedException} exception as its cause. + * with a CompletionException holding a {@link NoCfsProvidedException} as its cause. *

* Same as {@link #anyOfSuccess(CompletableFuture[])}, * but return result type is specified type instead of {@code Object}. @@ -242,6 +250,10 @@ public static CompletableFuture anyOfSuccessWithType(CompletableFuture return (CompletableFuture) anyOfSuccess(cfs); } + //////////////////////////////////////////////////////////////////////////////// + //# combine methods + //////////////////////////////////////////////////////////////////////////////// + /** * Returns a new CompletableFuture that is completed when the given two CompletableFutures complete. * If any of the given CompletableFutures complete exceptionally, then the returned diff --git a/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt b/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt index 8e763f70..0b4b0411 100644 --- a/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt +++ b/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt @@ -142,8 +142,8 @@ fun Array>.anyOfCompletableFutureAny(): CompletableFuture Collection>.anyOfSuccessCompletableFuture(): Comple * 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 a {@link NoCfsProvidedException} exception as its cause. + * returns a new CompletableFuture that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CompletableFutureUtils.anyOfSuccess], providing this method is convenient for method chaining. * @@ -174,8 +174,8 @@ fun Array>.anyOfSuccessCompletableFuture(): Completable * 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 a {@link NoCfsProvidedException} exception as its cause. + * returns a new CompletableFuture that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CompletableFutureUtils.anyOfSuccess], providing this method is convenient for method chaining. * @@ -190,9 +190,9 @@ fun Collection>.anyOfSuccessCompletableFutureAny(): Complet * Returns a new CompletableFuture that success 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 a {@link NoCfsProvidedException} exception as its cause. + * an exception CompletableFuture any of the given CompletableFutures as its cause. If no CompletableFutures are provided, + * returns a new Cffu that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CompletableFutureUtils.anyOfSuccessWithType], providing this method is convenient for method chaining. * @@ -535,8 +535,8 @@ fun Array>.anyOfCffuAny(cffuFactory: CffuFactory): Cffu Collection>.anyOfSuccessCffu(cffuFactory: CffuFactory): Cffu * with the same result. Otherwise, all the given Cffus complete exceptionally, * the returned Cffu also does so, with a CompletionException holding * an exception from any of the given Cffus as its cause. If no Cffus are provided, - * returns a new Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * returns a new Cffu that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CffuFactory.cffuAnyOfSuccess], providing this method is convenient for method chaining. * @@ -567,8 +567,8 @@ fun Array>.anyOfSuccessCffu(cffuFactory: CffuFactory): Cffu = * with the same result. Otherwise, all the given CompletableFutures complete exceptionally, * the returned Cffu 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 Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * returns a new Cffu that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CffuFactory.cffuAnyOfSuccess], providing this method is convenient for method chaining. * @@ -584,8 +584,8 @@ fun Collection>.anyOfSuccessCffu(cffuFactory: CffuFacto * with the same result. Otherwise, all the given CompletableFutures complete exceptionally, * the returned Cffu 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 Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * returns a new Cffu that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CffuFactory.cffuAnyOfSuccess], providing this method is convenient for method chaining. * @@ -600,8 +600,8 @@ fun Array>.anyOfSuccessCffu(cffuFactory: CffuFactory): * with the same result. Otherwise, all the given CompletableFutures complete exceptionally, * the returned Cffu 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 Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * returns a new Cffu that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CffuFactory.anyOfSuccess], providing this method is convenient for method chaining. * @@ -616,8 +616,8 @@ fun Collection>.anyOfSuccessCffuAny(cffuFactory: CffuFactory): Cffu * with the same result. Otherwise, all the given CompletableFutures complete exceptionally, * the returned Cffu 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 Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * returns a new Cffu that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CffuFactory.anyOfSuccess], providing this method is convenient for method chaining. * @@ -632,8 +632,8 @@ fun Array>.anyOfSuccessCffuAny(cffuFactory: CffuFactory): Cffu = * with the same result. Otherwise, all the given CompletableFutures complete exceptionally, * the returned Cffu 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 Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * returns a new Cffu that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CffuFactory.anyOfSuccess], providing this method is convenient for method chaining. * @@ -649,8 +649,8 @@ fun Collection>.anyOfSuccessCffuAny(cffuFactory: CffuFactor * with the same result. Otherwise, all the given CompletableFutures complete exceptionally, * the returned Cffu 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 Cffu that is already completed exceptionally - * with a CompletionException holding a {@link NoCfsProvidedException} exception as its cause. + * returns a new Cffu that is already completed exceptionally with a CompletionException + * holding a [NoCfsProvidedException][io.foldright.cffu.NoCfsProvidedException] as its cause. * * Same as [CffuFactory.anyOfSuccess], providing this method is convenient for method chaining. *