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 95f69f04..b244cd48 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java +++ b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java @@ -2903,13 +2903,9 @@ public void obtrudeException(Throwable ex) { /** * Returns the underlying CompletableFuture. * In general, you should NEVER use this method, use {@link #toCompletableFuture()} instead. - *

- * {@link CffuFactory#cffuArrayUnwrap(Cffu[])} is the batch operation to this method. * * @return the underlying CompletableFuture * @see #toCompletableFuture() - * @see CffuFactory#cffuArrayUnwrap(Cffu[]) - * @see #toCompletableFuture() */ @Contract(pure = true) @SuppressFBWarnings("EI_EXPOSE_REP") 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 c983ff45..c19a81f5 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java @@ -1611,30 +1611,11 @@ public Executor delayedExecutor(long delay, TimeUnit unit, Executor executor) { // endregion //////////////////////////////////////////////////////////////////////////////// - // region# Conversion Methods(static methods) + // region# Conversion Methods // - // - cffuArrayUnwrap: Cffu[] -> CompletableFuture[] // - cffuListToArray: List -> Cffu[] //////////////////////////////////////////////////////////////////////////////// - /** - * A convenient util method for unwrap input {@link Cffu} array elements by {@link Cffu#cffuUnwrap()}. - * - * @param cfs the Cffus - * @see CompletableFutureUtils#toCompletableFutureArray(CompletionStage[]) - * @see Cffu#cffuUnwrap() - */ - @Contract(pure = true) - @SafeVarargs - public static CompletableFuture[] cffuArrayUnwrap(Cffu... cfs) { - @SuppressWarnings("unchecked") - CompletableFuture[] ret = new CompletableFuture[cfs.length]; - for (int i = 0; i < cfs.length; i++) { - ret[i] = requireNonNull(cfs[i], "cf" + (i + 1) + " is null").cffuUnwrap(); - } - return ret; - } - /** * Convert Cffu list to Cffu array. * diff --git a/cffu-core/src/test/java/io/foldright/cffu/CffuFactoryTest.java b/cffu-core/src/test/java/io/foldright/cffu/CffuFactoryTest.java index 51118a06..4df97fd0 100644 --- a/cffu-core/src/test/java/io/foldright/cffu/CffuFactoryTest.java +++ b/cffu-core/src/test/java/io/foldright/cffu/CffuFactoryTest.java @@ -860,25 +860,9 @@ void test_toCffuArray() throws Exception { //////////////////////////////////////////////////////////////////////////////// // region# Conversion Methods(static methods) // - // - cffuArrayUnwrap: Cffu[] -> CompletableFuture[] // - cffuListToArray: List -> Cffu[] //////////////////////////////////////////////////////////////////////////////// - @Test - void test_cffuArrayUnwrap() { - @SuppressWarnings("unchecked") - CompletableFuture[] cfArray = new CompletableFuture[]{ - completedFuture(n), - completedFuture(anotherN) - }; - @SuppressWarnings("unchecked") - Cffu[] input = new Cffu[]{ - cffuFactory.toCffu(cfArray[0]), - cffuFactory.toCffu(cfArray[1]), - }; - assertArrayEquals(cfArray, CffuFactory.cffuArrayUnwrap(input)); - } - @Test void test_toCompletableFutureArray() { @SuppressWarnings("unchecked") diff --git a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt index 4c74a054..466f54d0 100644 --- a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt +++ b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt @@ -600,28 +600,3 @@ fun Collection>.anyOfCffu(cffuFactory: CffuFactory): */ fun Array>.anyOfCffu(cffuFactory: CffuFactory): Cffu = cffuFactory.anyOf(*this) - -// endregion -//////////////////////////////////////////////////////////////////////////////// -// region# cffuUnwrap methods for Collection/Array -//////////////////////////////////////////////////////////////////////////////// - -/** - * Unwrap input [Cffu] collection elements by [Cffu.cffuUnwrap]. - * - * This method is the same as [CffuFactory.cffuArrayUnwrap], providing this method is convenient for method chaining. - * - * @see CffuFactory.cffuArrayUnwrap - */ -fun Collection>.cffuUnwrap(): List> = - map { it.cffuUnwrap() } - -/** - * Unwrap input [Cffu] array elements by [Cffu.cffuUnwrap]. - * - * This method is the same as [CffuFactory.cffuArrayUnwrap], providing this method is convenient for method chaining. - * - * @see CffuFactory.cffuArrayUnwrap - */ -fun Array>.cffuUnwrap(): Array> = - CffuFactory.cffuArrayUnwrap(*this) diff --git a/cffu-kotlin/src/test/java/io/foldright/cffu/test/CffuExtensionsTest.kt b/cffu-kotlin/src/test/java/io/foldright/cffu/test/CffuExtensionsTest.kt index b682ea36..9543e9f6 100644 --- a/cffu-kotlin/src/test/java/io/foldright/cffu/test/CffuExtensionsTest.kt +++ b/cffu-kotlin/src/test/java/io/foldright/cffu/test/CffuExtensionsTest.kt @@ -655,23 +655,4 @@ class CffuExtensionsTest : FunSpec({ it.shouldNotBeTypeOf>>() } } - - //////////////////////////////////////// - // cffuUnwrap - //////////////////////////////////////// - - test("cffuUnwrap for Cffu collection/array") { - val range = 0 until 10 - val cfs: List> = range.map { - CompletableFuture.completedFuture(it) - } - val cfArray = cfs.toTypedArray() - - val cffus: List> = cfs.toCffu(testCffuFactory) - cffus.cffuUnwrap() shouldBe cfs - cffus.toSet().cffuUnwrap() shouldBe cfs - - val cffuArray: Array> = cffus.toTypedArray() - cffuArray.cffuUnwrap() shouldBe cfArray - } })