From b6823342ee7facf654a49584e1542eab7de866e5 Mon Sep 17 00:00:00 2001
From: huhaosumail <995483610@qq.com>
Date: Mon, 24 Jun 2024 20:44:35 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4tupleMApplyMostSuccessAsync?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/main/java/io/foldright/cffu/Cffu.java | 63 ---------------
 .../cffu/CompletableFutureUtils.java          | 76 -------------------
 .../test/java/io/foldright/cffu/CffuTest.java | 33 --------
 .../cffu/CompletableFutureUtilsTest.java      | 36 ---------
 4 files changed, 208 deletions(-)

diff --git a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java
index 366bc699..59d42561 100644
--- a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java
+++ b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java
@@ -292,69 +292,6 @@ public <U1, U2, U3, U4, U5> Cffu<Tuple5<U1, U2, U3, U4, U5>> thenTupleMApplyFast
         return reset0(CompletableFutureUtils.thenTupleMApplyFastFailAsync(cf, fn1, fn2, fn3, fn4, fn5));
     }
 
-    /**
-     * Returns a new Cffu that, when this Cffu completes normally,
-     * is executed using the {@link #defaultExecutor()},
-     * with the values obtained by calling the given Functions
-     * (with this Cffu's result as the argument to the given functions)
-     * in the <strong>same order</strong> of the given Functions arguments.
-     * <p>
-     *
-     * @return the new Cffu
-     */
-    @Contract(pure = true)
-    public <U1, U2> Cffu<Tuple2<U1, U2>> tupleMApplyMostSuccessAsync(
-            long timeout, TimeUnit unit,   Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) {
-        return reset0(CompletableFutureUtils.tupleMApplyMostSuccessAsync(fac.defaultExecutor(),cf,timeout,unit, fn1, fn2));
-    }
-
-    /**
-     * Returns a new Cffu that, when this Cffu completes normally,
-     * is executed using the {@link #defaultExecutor()},
-     * with the values obtained by calling the given Functions
-     * (with this Cffu's result as the argument to the given functions)
-     * in the <strong>same order</strong> of the given Functions arguments.
-     * <p>
-     *
-     * @return the new Cffu
-     */
-    @Contract(pure = true)
-    public <U1, U2,U3> Cffu<Tuple3<U1, U2,U3>> tupleMApplyMostSuccessAsync(
-            long timeout, TimeUnit unit,   Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) {
-        return reset0(CompletableFutureUtils.tupleMApplyMostSuccessAsync(fac.defaultExecutor(),cf,timeout,unit, fn1, fn2,fn3));
-    }
-
-    /**
-     * Returns a new Cffu that, when this Cffu completes normally,
-     * is executed using the {@link #defaultExecutor()},
-     * with the values obtained by calling the given Functions
-     * (with this Cffu's result as the argument to the given functions)
-     * in the <strong>same order</strong> of the given Functions arguments.
-     * <p>
-     *
-     * @return the new Cffu
-     */
-    @Contract(pure = true)
-    public <U1,U2,U3,U4> Cffu<Tuple4<U1,U2,U3,U4>> tupleMApplyMostSuccessAsync(
-            long timeout, TimeUnit unit,   Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3 , Function<? super T, ? extends U4> fn4) {
-        return reset0(CompletableFutureUtils.tupleMApplyMostSuccessAsync(fac.defaultExecutor(),cf,timeout,unit, fn1, fn2,fn3,fn4));
-    }
-
-    /**
-     * Returns a new Cffu that, when this Cffu completes normally,
-     * is executed using the {@link #defaultExecutor()},
-     * with the values obtained by calling the given Functions
-     * (with this Cffu's result as the argument to the given functions)
-     * in the <strong>same order</strong> of the given Functions arguments.
-     * <p>
-     *
-     * @return the new Cffu
-     */
-    @Contract(pure = true)
-    public <U1,U2,U3,U4,U5> Cffu<Tuple5<U1,U2,U3,U4,U5>> tupleMApplyMostSuccessAsync(
-            long timeout, TimeUnit unit,   Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3 , Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) {
-        return reset0(CompletableFutureUtils.tupleMApplyMostSuccessAsync(fac.defaultExecutor(),cf,timeout,unit, fn1, fn2,fn3,fn4,fn5));
-    }
 
     /**
      * Returns a new Cffu that, when this Cffu completes normally,
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 e04626b4..37a1c166 100644
--- a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java
+++ b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java
@@ -133,82 +133,6 @@ public static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(
     }
 
 
-
-
-
-    /**
-     * Returns a new CompletableFuture that is asynchronously completed
-     * by tasks running in the given Executor with the values obtained by calling the given Functions
-     * in the <strong>same order</strong> of the given Functions arguments.
-     *
-     * @param executor the executor to use for asynchronous execution
-     * @return the new CompletableFuture
-     */
-    public static <T,U1,U2> CompletableFuture<Tuple2<U1,U2>> tupleMApplyMostSuccessAsync(
-            Executor executor,CompletionStage<? extends T> cf, long timeout, TimeUnit unit,Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) {
-        requireNonNull(executor, "executor is null");
-        requireNonNull(unit, "unit is null");
-        Function<? super T, ?>[] fns = requireArrayAndEleNonNull("fn", fn1, fn2);
-
-        return mostTupleOfSuccess0(executor,timeout, unit, wrapFunctions(executor,null,fns));
-    }
-
-
-
-    /**
-     * Returns a new CompletableFuture that is asynchronously completed
-     * by tasks running in the given Executor with the values obtained by calling the given Functions
-     * in the <strong>same order</strong> of the given Functions arguments.
-     *
-     * @param executor the executor to use for asynchronous execution
-     * @return the new CompletableFuture
-     */
-    public static <T,U1,U2,U3> CompletableFuture<Tuple3<U1,U2,U3>> tupleMApplyMostSuccessAsync(
-            Executor executor,CompletionStage<? extends T> cf, long timeout, TimeUnit unit,Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) {
-        requireNonNull(executor, "executor is null");
-        requireNonNull(unit, "unit is null");
-        Function<? super T, ?>[] fns = requireArrayAndEleNonNull("fn", fn1, fn2,fn3);
-
-        return mostTupleOfSuccess0(executor,timeout, unit, wrapFunctions(executor,null,fns));
-    }
-
-
-    /**
-     * Returns a new CompletableFuture that is asynchronously completed
-     * by tasks running in the given Executor with the values obtained by calling the given Functions
-     * in the <strong>same order</strong> of the given Functions arguments.
-     *
-     * @param executor the executor to use for asynchronous execution
-     * @return the new CompletableFuture
-     */
-    public static <T,U1,U2,U3,U4> CompletableFuture<Tuple4<U1,U2,U3,U4>> tupleMApplyMostSuccessAsync(
-            Executor executor,CompletionStage<? extends T> cf, long timeout, TimeUnit unit,Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) {
-        requireNonNull(executor, "executor is null");
-        requireNonNull(unit, "unit is null");
-        Function<? super T, ?>[] fns = requireArrayAndEleNonNull("fn", fn1, fn2,fn3,fn4);
-
-        return mostTupleOfSuccess0(executor,timeout, unit, wrapFunctions(executor,null,fns));
-    }
-
-
-    /**
-     * Returns a new CompletableFuture that is asynchronously completed
-     * by tasks running in the given Executor with the values obtained by calling the given Functions
-     * in the <strong>same order</strong> of the given Functions arguments.
-     *
-     * @param executor the executor to use for asynchronous execution
-     * @return the new CompletableFuture
-     */
-    public static <T,U1,U2,U3,U4,U5> CompletableFuture<Tuple5<U1,U2,U3,U4,U5>> tupleMApplyMostSuccessAsync(
-            Executor executor,CompletionStage<? extends T> cf, long timeout, TimeUnit unit,Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) {
-        requireNonNull(executor, "executor is null");
-        requireNonNull(unit, "unit is null");
-        Function<? super T, ?>[] fns = requireArrayAndEleNonNull("fn", fn1, fn2,fn3,fn4,fn5);
-
-        return mostTupleOfSuccess0(executor,timeout, unit, wrapFunctions(executor,null,fns));
-    }
-
-
     /**
      * Returns a new CompletableFuture that is asynchronously completed
      * by tasks running in the given Executor with the values obtained by calling the given Suppliers
diff --git a/cffu-core/src/test/java/io/foldright/cffu/CffuTest.java b/cffu-core/src/test/java/io/foldright/cffu/CffuTest.java
index 75e2bb44..54bc0def 100644
--- a/cffu-core/src/test/java/io/foldright/cffu/CffuTest.java
+++ b/cffu-core/src/test/java/io/foldright/cffu/CffuTest.java
@@ -74,39 +74,6 @@ void test_thenTupleMApplyAsync() throws Exception {
         assertEquals(Tuple5.of(n, s, d, anotherN, n + n), completed.thenTupleMApplyFastFailAsync(function_n, function_s, function_d, function_an, function_nn).get());
     }
 
-    @Test
-    void test_thenMApplyMostSuccessAsync() throws Exception {
-        final Cffu<Integer> completed = cffuFactory.completedFuture(n);
-        final Function<Integer,Integer> function_n = (x) -> {
-            sleep(100);
-            return n;
-        };
-
-        final Function<Integer,String> function_s = (x) -> {
-            sleep(100);
-            return s;
-        };
-
-        final Function<Integer,Double> function_d = (x) -> {
-            sleep(100);
-            return d;
-        };
-        final Function<Integer,Integer> function_an = (x) -> {
-            sleep(100);
-            return anotherN;
-        };
-        final Function<Integer,Integer> function_nn = (x) -> {
-            sleep(100);
-            return n+n;
-        };
-        assertEquals(Tuple2.of(n, s), completed.tupleMApplyMostSuccessAsync(10, TimeUnit.MILLISECONDS,function_n, function_s).get());
-
-        assertEquals(Tuple3.of(n, s, d),  completed.tupleMApplyMostSuccessAsync(10, TimeUnit.MILLISECONDS,function_n, function_s, function_d).get());
-
-        assertEquals(Tuple4.of(n, s, d, anotherN),  completed.tupleMApplyMostSuccessAsync(10, TimeUnit.MILLISECONDS,function_n, function_s, function_d, function_an).get());
-
-        assertEquals(Tuple5.of(n, s, d, anotherN, n + n),  completed.tupleMApplyMostSuccessAsync(10, TimeUnit.MILLISECONDS,function_n, function_s, function_d, function_an, function_nn).get());
-    }
 
     ////////////////////////////////////////////////////////////////////////////////
     //# both methods
diff --git a/cffu-core/src/test/java/io/foldright/cffu/CompletableFutureUtilsTest.java b/cffu-core/src/test/java/io/foldright/cffu/CompletableFutureUtilsTest.java
index 9332ebab..40f1a907 100644
--- a/cffu-core/src/test/java/io/foldright/cffu/CompletableFutureUtilsTest.java
+++ b/cffu-core/src/test/java/io/foldright/cffu/CompletableFutureUtilsTest.java
@@ -818,42 +818,6 @@ void test_tupleMSupplyMostSuccessAsync() throws Exception {
         assertEquals(Tuple5.of(n, s, d, anotherN, n + n), tupleMSupplyMostSuccessAsync(defaultExecutor(),10, TimeUnit.MILLISECONDS,supplier_n, supplier_s, supplier_d, supplier_an, supplier_nn).get());
     }
 
-    @Test
-    void test_tupleMApplyMostSuccessAsync() throws Exception {
-        final CompletableFuture<Integer> completed = completedFuture(n);
-        final Function<Integer,Integer> function_n = (x) -> {
-            sleep(100);
-            return n;
-        };
-
-        final Function<Integer,String> function_s = (x) -> {
-            sleep(100);
-            return s;
-        };
-
-        final Function<Integer,Double> function_d = (x) -> {
-            sleep(100);
-            return d;
-        };
-        final Function<Integer,Integer> function_an = (x) -> {
-            sleep(100);
-            return anotherN;
-        };
-        final Function<Integer,Integer> function_nn = (x) -> {
-            sleep(100);
-            return n+n;
-        };
-        assertEquals(Tuple2.of(n, s), tupleMApplyMostSuccessAsync(defaultExecutor(),completed,10, TimeUnit.MILLISECONDS,function_n, function_s).get());
-
-        assertEquals(Tuple3.of(n, s, d), tupleMApplyMostSuccessAsync(defaultExecutor(),completed,10, TimeUnit.MILLISECONDS,function_n, function_s, function_d).get());
-
-        assertEquals(Tuple4.of(n, s, d, anotherN), tupleMApplyMostSuccessAsync(defaultExecutor(),completed,10, TimeUnit.MILLISECONDS,function_n, function_s, function_d, function_an).get());
-
-        assertEquals(Tuple5.of(n, s, d, anotherN, n + n), tupleMApplyMostSuccessAsync(defaultExecutor(),completed,10, TimeUnit.MILLISECONDS,function_n, function_s, function_d, function_an, function_nn).get());
-    }
-
-
-
     @Test
     void test_thenTupleMApplyAsync() throws Exception {
         final CompletableFuture<Integer> completed = completedFuture(n);