| Modifiers | Name | Description |
|---|---|---|
static class |
Closures.ConsumerClosure |
Hybrid one-argument function that is both a Closure and a Consumer. |
static class |
Closures.FunctionClosure |
Hybrid one-argument function that is both a Closure and a Function. |
static class |
Closures.PredicateClosure |
Hybrid one-argument function that is both a Closure and a Predicate. |
| Type Params | Return Type | Name and description |
|---|---|---|
<T, P> |
public static PredicateClosure<T> |
curryWith(BiPredicate<? super T, ? super P> bp, P p)Right-partials a BiPredicate and lifts the result into a hybrid usable as both Closure and Predicate. |
<T, P, R> |
public static FunctionClosure<T, R> |
curryWith(BiFunction<? super T, ? super P, ? extends R> bf, P p)Right-partials a BiFunction and lifts the result into a hybrid usable as both Closure and Function. |
<T, P> |
public static ConsumerClosure<T> |
curryWith(BiConsumer<? super T, ? super P> bc, P p)Right-partials a BiConsumer and lifts the result into a hybrid usable as both Closure and Consumer. |
<T> |
public static PredicateClosure<T> |
from(Predicate<T> p)Lifts a Predicate into a hybrid that is also a Closure. |
<T, R> |
public static FunctionClosure<T, R> |
from(Function<T, R> f)Lifts a Function into a hybrid that is also a Closure. |
<T> |
public static ConsumerClosure<T> |
from(Consumer<T> c)Lifts a Consumer into a hybrid that is also a Closure. |
Right-partials a BiPredicate and lifts the result into a
hybrid usable as both Closure and Predicate.
Equivalent to from(Lambdas.curryWith(bp, p)).
BiPredicate<Integer,Integer> divisibleBy = (n, d) -> n % d == 0
assert [1, 2, 3, 4, 5].findAll(curryWith(divisibleBy, 2)) == [2, 4]
Right-partials a BiFunction and lifts the result into a
hybrid usable as both Closure and Function.
Equivalent to from(Lambdas.curryWith(bf, p)).
Right-partials a BiConsumer and lifts the result into a
hybrid usable as both Closure and Consumer.
Equivalent to from(Lambdas.curryWith(bc, p)).
Lifts a Predicate into a hybrid that is also a
Closure. If p is already a PredicateClosure
it is returned unchanged.
Predicate<Integer> isEven = n -> n % 2 == 0
assert [1, 2, 3, 4].findAll(Closures.from(isEven)) == [2, 4]
Lifts a Function into a hybrid that is also a
Closure. If f is already a FunctionClosure
it is returned unchanged.
Lifts a Consumer into a hybrid that is also a
Closure. If c is already a ConsumerClosure
it is returned unchanged.