public class Functional extends Object
Modifier and Type | Method and Description |
---|---|
static <T> CompletableFuture<T> |
asyncFailableFuture(Callable<T> call,
Executor exec)
Execute a callable on the provided executor, capturing the result or any exceptions that may be thrown into a
CompletableFuture . |
static <T> CompletableFuture<T> |
failableFuture(Callable<T> call)
Execute a callable on the current thread, capturing the result or any exceptions that may be thrown into a
CompletableFuture . |
static <E> Predicate<E> |
java8ToGuava(java.util.function.Predicate<E> predicate) |
static <T> Set<T> |
optionalAsSet(Optional<T> value)
Get the value of an
Optional as either a zero- or one-element immutable set. |
static <E> java.util.function.Predicate<E> |
predicateAnd(Iterable<java.util.function.Predicate<E>> predicates)
Perform an AND using an iterable of predicates.
|
static <E> java.util.function.Predicate<E> |
predicateAnd(java.util.function.Predicate<E>... predicates)
Perform an AND using an array of predicates.
|
static <E> java.util.function.Predicate<E> |
predicateIn(Collection<E> collection) |
public static <E> java.util.function.Predicate<E> predicateAnd(java.util.function.Predicate<E>... predicates)
E
- The type to acceptpredicates
- The predicates to ANDpublic static <E> java.util.function.Predicate<E> predicateAnd(Iterable<java.util.function.Predicate<E>> predicates)
E
- The type to acceptpredicates
- The predicates to andpublic static <E> java.util.function.Predicate<E> predicateIn(Collection<E> collection)
public static <E> Predicate<E> java8ToGuava(java.util.function.Predicate<E> predicate)
public static <T> Set<T> optionalAsSet(Optional<T> value)
Optional
as either a zero- or one-element immutable set.T
- The typevalue
- The value to get as a setpublic static <T> CompletableFuture<T> failableFuture(Callable<T> call)
CompletableFuture
.T
- The type of value returnedcall
- The callable to executepublic static <T> CompletableFuture<T> asyncFailableFuture(Callable<T> call, Executor exec)
CompletableFuture
.T
- The type of value returnedcall
- The callable to executeexec
- The executor to execute this task on