Package org.bitcoinj.base.internal
Class FutureUtils
- java.lang.Object
-
- org.bitcoinj.base.internal.FutureUtils
-
public class FutureUtils extends java.lang.ObjectUtilities forCompletableFuture.Note: When the bitcoinj migration to
CompletableFutureis finished this class will either be removed or its remaining methods changed to use genericCompletableFutures.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFutureUtils.ThrowingSupplier<T>Subinterface ofSupplierfor Lambdas which throw exceptions.
-
Constructor Summary
Constructors Constructor Description FutureUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> java.util.concurrent.CompletableFuture<java.util.List<T>>allAsList(java.util.List<? extends java.util.concurrent.CompletionStage<? extends T>> stages)Note: When the migration toCompletableFutureis complete this routine will either be removed or changed to return a genericCompletableFuture.static <T> java.util.concurrent.CompletableFuture<T>failedFuture(java.lang.Throwable t)Can be replaced withCompletableFuture.failedFuture(Throwable)in Java 9+.static <T> java.util.concurrent.CompletableFuture<java.util.List<T>>successfulAsList(java.util.List<? extends java.util.concurrent.CompletionStage<? extends T>> stages)Note: When the migration toCompletableFutureis complete this routine will either be removed or changed to return a genericCompletableFuture.
-
-
-
Method Detail
-
allAsList
public static <T> java.util.concurrent.CompletableFuture<java.util.List<T>> allAsList(java.util.List<? extends java.util.concurrent.CompletionStage<? extends T>> stages)
Note: When the migration toCompletableFutureis complete this routine will either be removed or changed to return a genericCompletableFuture.- Type Parameters:
T- the result type- Parameters:
stages- A list ofCompletionStages all returning the same type- Returns:
- A CompletableFuture that returns a list of result type
-
successfulAsList
public static <T> java.util.concurrent.CompletableFuture<java.util.List<T>> successfulAsList(java.util.List<? extends java.util.concurrent.CompletionStage<? extends T>> stages)
Note: When the migration toCompletableFutureis complete this routine will either be removed or changed to return a genericCompletableFuture.- Type Parameters:
T- the result type- Parameters:
stages- A list ofCompletionStages all returning the same type- Returns:
- A CompletableFuture that returns a list of result type
-
failedFuture
public static <T> java.util.concurrent.CompletableFuture<T> failedFuture(java.lang.Throwable t)
Can be replaced withCompletableFuture.failedFuture(Throwable)in Java 9+.- Type Parameters:
T- the future's return type- Parameters:
t- Exception that is causing the failure- Returns:
- a failed future containing the specified exception
-
-