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 <L,R> BiPredicate<L,R> |
biPredicateAnd(BiPredicate<L,R>... predicates)
Perform an AND using an array of bi-predicates.
|
static <L,R> BiPredicate<L,R> |
biPredicateAnd(Iterable<BiPredicate<L,R>> predicates)
Perform an AND using an iterable of bi-predicates.
|
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> |
guavaToJava8(Predicate<E> p)
|
static <E> Predicate<E> |
java8ToGuava(Predicate<E> predicate)
|
static <T> Set<T> |
optionalAsSet(Optional<T> value)
Gets the value of an
Optional as either a zero- or one-element immutable set. |
static <E> Predicate<E> |
predicateAnd(Iterable<Predicate<E>> predicates)
Perform an AND using an iterable of predicates.
|
static <E> Predicate<E> |
predicateAnd(Predicate<E>... predicates)
Perform an AND using an array of predicates.
|
static <E> Predicate<E> |
predicateIn(Collection<E> collection)
|
@SafeVarargs public static <E> Predicate<E> predicateAnd(Predicate<E>... predicates)
E
- The type to acceptpredicates
- The predicates to ANDpublic static <E> Predicate<E> predicateAnd(Iterable<Predicate<E>> predicates)
E
- The type to acceptpredicates
- The predicates to and@SafeVarargs public static <L,R> BiPredicate<L,R> biPredicateAnd(BiPredicate<L,R>... predicates)
L
- The left type to acceptR
- The right type to acceptpredicates
- The bi-predicates to ANDpublic static <L,R> BiPredicate<L,R> biPredicateAnd(Iterable<BiPredicate<L,R>> predicates)
L
- The left type to acceptR
- The right type to acceptpredicates
- The bi-predicates to andpublic static <E> Predicate<E> predicateIn(Collection<E> collection)
E
- The type of objectcollection
- The collectionpublic static <E> Predicate<E> java8ToGuava(Predicate<E> predicate)
Predicate
based on the provided Predicate
, used
to transform between Java 8 specific code to those from the guava
library.E
- The type of objectpredicate
- The predicate@Deprecated public static <E> Predicate<E> guavaToJava8(Predicate<E> p)
Predicate
based on the provided Predicate
,
used to transform between Java 8 specific code to those from the guava
library.E
- The type of objectp
- The predicatepublic 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