public class CompletableFutureAdapter
extends java.lang.Object
ListenableFuture
and java's provided
CompletableFuture
. The threadly project prefers ListenableFuture
as it is able
to be more performant, as well as in some cases provide additional features. Still, the
concepts are very similar, making it easy for this class to convert between the types.Constructor and Description |
---|
CompletableFutureAdapter() |
Modifier and Type | Method and Description |
---|---|
static <T> java.util.concurrent.CompletableFuture<T> |
toCompletable(ListenableFuture<? extends T> lf)
Convert from a
ListenableFuture to CompletableFuture . |
static <T> ListenableFuture<T> |
toListenable(java.util.concurrent.CompletableFuture<? extends T> cf)
Convert from a
CompletableFuture to ListenableFuture . |
public static <T> java.util.concurrent.CompletableFuture<T> toCompletable(ListenableFuture<? extends T> lf)
ListenableFuture
to CompletableFuture
.T
- Type of result provided by the futurelf
- The future to adapt into a CompletableFuture
public static <T> ListenableFuture<T> toListenable(java.util.concurrent.CompletableFuture<? extends T> cf)
CompletableFuture
to ListenableFuture
.T
- Type of result provided by the futurecf
- The future to adapt into a ListenableFuture