@FunctionalInterface public interface LPredicate<T> extends java.util.function.Predicate<T>, MetaPredicate, MetaInterface.NonThrowing, OFunction<T,aType.aBool>, Codomain<aType.aBool>, Domain1<aType.a<T>>
Non-throwing functional interface (lambda) LPredicate for Java 8.
Type: predicate
Domain (lvl: 1): T a
Co-domain: boolean
Special case of function that corresponds to expressions like (iterator) -> Iterator::next
| Modifier and Type | Interface and Description |
|---|---|
static class |
LPredicate.LPredicateSingle<T> |
| Modifier and Type | Field and Description |
|---|---|
static String |
DESCRIPTION |
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
alwaysFalse(T a)
Returns FALSE.
|
static <T> boolean |
alwaysTrue(T a)
Returns TRUE.
|
default LPredicate<T> |
and(LPredicate<? super T> other)
Returns a predicate that represents the logical AND of evaluation of this predicate and the argument one.
|
default <V> LFunction<T,V> |
boolToFunc(LBoolFunction<? extends V> after)
Combines two functions together in a order.
|
default LPredicate<T> |
boolToPred(LLogicalOperator after)
Combines two functions together in a order.
|
default LToByteFunction<T> |
boolToToByteFunc(LBoolToByteFunction after)
Combines two functions together in a order.
|
default LToCharFunction<T> |
boolToToCharFunc(LBoolToCharFunction after)
Combines two functions together in a order.
|
default LToDblFunction<T> |
boolToToDblFunc(LBoolToDblFunction after)
Combines two functions together in a order.
|
default LToFltFunction<T> |
boolToToFltFunc(LBoolToFltFunction after)
Combines two functions together in a order.
|
default LToIntFunction<T> |
boolToToIntFunc(LBoolToIntFunction after)
Combines two functions together in a order.
|
default LToLongFunction<T> |
boolToToLongFunc(LBoolToLongFunction after)
Combines two functions together in a order.
|
default LToSrtFunction<T> |
boolToToSrtFunc(LBoolToSrtFunction after)
Combines two functions together in a order.
|
static <T> boolean |
call(T a,
LPredicate<T> lambda) |
default LBoolSupplier |
capture(T a)
Captures arguments but delays the evaluation.
|
default <V2> LPredicate<V2> |
cast()
Cast that replace generics.
|
static <V2,T> LPredicate<V2> |
cast(LPredicate<T> function)
Cast that replace generics.
|
default <V> LPredicate<V> |
compose(LFunction<? super V,? extends T> before)
Allows to manipulate the domain of the function.
|
static <V,T> LPredicate<V> |
composed(LFunction<? super V,? extends T> before,
LPredicate<T> after) |
static <T> LPredicate<T> |
constant(boolean r)
Creates function that always returns the same value.
|
default boolean |
doApplyAsBoolean(T a)
For convenience, where “test()” makes things more confusing than “applyAsBoolean()”.
|
default boolean |
doIf(T a,
LAction action) |
default boolean |
doIf(T a,
LConsumer<? super T> consumer) |
static <T> boolean |
doIf(T a,
LPredicate<T> predicate,
LAction action) |
static <T> boolean |
doIf(T a,
LPredicate<T> predicate,
LConsumer<? super T> consumer) |
default <V> boolean |
doIf(V a1,
int a2,
T a3,
LTieConsumer<? super V,? super T> consumer) |
default <V> int |
doIf(V a1,
int a2,
T a3,
LTieFunction<? super V,? super T> consumer) |
default <V> boolean |
doIf(V a1,
T a2,
int a3,
LBiObjIntConsumer<? super V,? super T> consumer) |
default <V> boolean |
doIf(V a1,
T a2,
LBiConsumer<V,? super T> consumer) |
default <V> int |
doIf(V a1,
T a2,
LToIntBiFunction<V,? super T> consumer)
2
|
static <T> LPredicate<T> |
failSafe(LPredicate<T> func,
LPredicate<T> failSafe) |
default boolean |
failSafeTest(T a,
LPredicate<T> failSafe) |
static <T> boolean |
failSafeTest(T a,
LPredicate<T> func,
LPredicate<T> failSafe) |
default <C0> void |
filterForEach(IndexedRead<C0,aType.a<T>> ia,
C0 source,
LConsumer<? super T> consumer)
For each element (or tuple) from arguments, calls the consumer if predicate test passes.
|
default <C0,I0> void |
filterIterate(SequentialRead<C0,I0,aType.a<T>> sa,
C0 source,
LConsumer<? super T> consumer)
For each element (or tuple) from arguments, calls the consumer if predicate test passes.
|
static <T> void |
fromTill(int min_i,
int max_i,
T a,
LPredicate<T> func)
From-To.
|
static <T> void |
fromTo(int min_i,
int max_i,
T a,
LPredicate<T> func)
From-To.
|
default String |
functionalInterfaceDescription()
Returns description of the functional interface.
|
default LPredicate<T> |
handling(HandlingInstructions<Throwable,RuntimeException> handling) |
default boolean |
handlingTest(T a,
HandlingInstructions<Throwable,RuntimeException> handling)
Function call that handles exceptions according to the instructions.
|
static <T> boolean |
handlingTest(T a,
LPredicate<T> func,
HandlingInstructions<Throwable,RuntimeException> handling) |
static <T> LPredicate<T> |
isEqual(T target)
Creates predicate that evaluates if an object is equal with the argument one.
|
default LPredicate<T> |
negate()
Returns a predicate that represents the logical negation of this predicate.
|
default boolean |
nestingTest(T a)
Function call that handles exceptions by always nesting checked exceptions and propagating the others as is.
|
default boolean |
nonNullTest(T a)
Just to mirror the method: Ensures the result is not null
|
default LPredicate<T> |
or(LPredicate<? super T> other)
Returns a predicate that represents the logical OR of evaluation of this predicate and the argument one.
|
static <T> LPredicate<T> |
pred(LPredicate<T> lambda)
Convenient method in case lambda expression is ambiguous for the compiler (that might happen for overloaded methods accepting different interfaces).
|
static <T> LPredicate<T> |
predThrowing(ExF<Throwable> exF) |
static <T> LPredicate<T> |
predThrowing(String message,
ExMF<Throwable> exF) |
static <T> LPredicate<T> |
recursive(LFunction<LPredicate<T>,LPredicate<T>> selfLambda) |
static <T> LPredicate<T> |
safe()
Safe instance.
|
static <T> LPredicate<T> |
safe(LPredicate<T> other)
Safe wrapping.
|
static <T> LSupplier<LPredicate<T>> |
safeSupplier()
Safe instance supplier.
|
static <T> LSupplier<LPredicate<T>> |
safeSupplier(LSupplier<LPredicate<T>> supplier)
Safe supplier.
|
default boolean |
shovingTest(T a)
Function call that handles exceptions by always propagating them as is, even when they are undeclared checked ones.
|
default <V,C0> int |
targetedForEach(V v,
IndexedRead<C0,aType.a<T>> ia,
C0 source,
LBiObjIntConsumer<V,T> consumer)
For each element (or tuple) from arguments, calls the consumer (with index) if predicate test passes.
|
default <V,C0,I0> int |
targetedIterate(V v,
SequentialRead<C0,I0,aType.a<T>> sa,
C0 source,
LBiObjIntConsumer<V,T> consumer)
For each element (or tuple) from arguments, calls the consumer (with index) if predicate test passes.
|
default boolean |
test(T a) |
default boolean |
test(T a,
ExWF<RuntimeException> exF) |
default boolean |
test(T a,
ExWMF<RuntimeException> exF,
String newMessage,
Object... messageParams) |
default boolean |
testThen(T a,
LPredicate<Throwable> handler) |
boolean |
testX(T a)
Implement this, but call test(T a)
|
static <T> void |
throwIf(T a,
LPredicate<T> pred,
ExMF<RuntimeException> factory,
String newMessage,
Object... messageParams) |
static <T> void |
throwIfNot(T a,
LPredicate<T> pred,
ExMF<RuntimeException> factory,
String newMessage,
Object... messageParams) |
default <V,C0> int |
tieForEach(V v,
IndexedRead<C0,aType.a<T>> ia,
C0 source,
LTieConsumer<V,T> consumer)
For each element (or tuple) from arguments, calls the consumer (with index) if predicate test passes.
|
default <V,C0,I0> int |
tieIterate(V v,
SequentialRead<C0,I0,aType.a<T>> sa,
C0 source,
LTieConsumer<V,T> consumer)
For each element (or tuple) from arguments, calls the consumer (with index) if predicate test passes.
|
static <T> void |
times(int max_i,
T a,
LPredicate<T> func)
From-To.
|
default LPredicate<T> |
trying(ExWF<RuntimeException> exF) |
default LPredicate<T> |
trying(ExWMF<RuntimeException> exF,
String newMessage,
Object... messageParams) |
default LPredicate<T> |
tryingThen(LPredicate<Throwable> handler) |
static <T> boolean |
tryTest(T a,
LPredicate<T> func) |
static <T> boolean |
tryTest(T a,
LPredicate<T> func,
ExWF<RuntimeException> exF) |
static <T> boolean |
tryTest(T a,
LPredicate<T> func,
ExWMF<RuntimeException> exF,
String newMessage,
Object... messageParams) |
static <T> boolean |
tryTestThen(T a,
LPredicate<T> func,
LPredicate<Throwable> handler) |
default boolean |
tupleTest(LSingle<T> args) |
default LPredicate |
untyped()
Cast that removes generics.
|
static <T> LPredicate<T> |
wrap(java.util.function.Predicate<T> other)
Wraps JRE instance.
|
default LPredicate<T> |
xor(LPredicate<? super T> other)
Returns a predicate that represents the logical XOR of evaluation of this predicate and the argument one.
|
and, orisPredicateisThrowingisFunctionformatTo, isAction, isConsumer, isOperator, isSupplierstatic final String DESCRIPTION
default boolean test(T a)
test in interface java.util.function.Predicate<T>default boolean handlingTest(T a, HandlingInstructions<Throwable,RuntimeException> handling)
Function call that handles exceptions according to the instructions.
default LPredicate<T> handling(HandlingInstructions<Throwable,RuntimeException> handling)
default boolean test(T a, @Nonnull ExWMF<RuntimeException> exF, @Nonnull String newMessage, @Nullable Object... messageParams)
default LPredicate<T> trying(@Nonnull ExWMF<RuntimeException> exF, @Nonnull String newMessage, @Nullable Object... messageParams)
default boolean test(T a, @Nonnull ExWF<RuntimeException> exF)
default LPredicate<T> trying(@Nonnull ExWF<RuntimeException> exF)
default boolean testThen(T a, @Nonnull LPredicate<Throwable> handler)
default LPredicate<T> tryingThen(@Nonnull LPredicate<Throwable> handler)
default boolean nestingTest(T a)
Function call that handles exceptions by always nesting checked exceptions and propagating the others as is.
default boolean shovingTest(T a)
Function call that handles exceptions by always propagating them as is, even when they are undeclared checked ones.
static <T> boolean handlingTest(T a,
LPredicate<T> func,
HandlingInstructions<Throwable,RuntimeException> handling)
static <T> boolean tryTest(T a,
LPredicate<T> func)
static <T> boolean tryTest(T a,
LPredicate<T> func,
@Nonnull
ExWMF<RuntimeException> exF,
@Nonnull
String newMessage,
@Nullable
Object... messageParams)
static <T> boolean tryTest(T a,
LPredicate<T> func,
@Nonnull
ExWF<RuntimeException> exF)
static <T> boolean tryTestThen(T a,
LPredicate<T> func,
@Nonnull
LPredicate<Throwable> handler)
default boolean failSafeTest(T a, @Nonnull LPredicate<T> failSafe)
static <T> boolean failSafeTest(T a,
LPredicate<T> func,
@Nonnull
LPredicate<T> failSafe)
static <T> LPredicate<T> failSafe(LPredicate<T> func, @Nonnull LPredicate<T> failSafe)
static <T> boolean doIf(T a,
@Nonnull
LPredicate<T> predicate,
@Nonnull
LAction action)
static <T> boolean doIf(T a,
@Nonnull
LPredicate<T> predicate,
@Nonnull
LConsumer<? super T> consumer)
static <T> void throwIf(T a,
LPredicate<T> pred,
ExMF<RuntimeException> factory,
@Nonnull
String newMessage,
@Nullable
Object... messageParams)
static <T> void throwIfNot(T a,
LPredicate<T> pred,
ExMF<RuntimeException> factory,
@Nonnull
String newMessage,
@Nullable
Object... messageParams)
default boolean nonNullTest(T a)
Just to mirror the method: Ensures the result is not null
default boolean doApplyAsBoolean(T a)
For convenience, where “test()” makes things more confusing than “applyAsBoolean()”.
@Nonnull default String functionalInterfaceDescription()
Returns description of the functional interface.
functionalInterfaceDescription in interface MetaFunctionalInterfacedefault <V> boolean doIf(V a1,
T a2,
LBiConsumer<V,? super T> consumer)
default <V> int doIf(V a1,
T a2,
LToIntBiFunction<V,? super T> consumer)
2
default <V> boolean doIf(V a1,
T a2,
int a3,
LBiObjIntConsumer<? super V,? super T> consumer)
default <V> boolean doIf(V a1,
int a2,
T a3,
LTieConsumer<? super V,? super T> consumer)
default <V> int doIf(V a1,
int a2,
T a3,
LTieFunction<? super V,? super T> consumer)
static <T> void fromTo(int min_i,
int max_i,
T a,
LPredicate<T> func)
From-To. Intended to be used with non-capturing lambda.
static <T> void fromTill(int min_i,
int max_i,
T a,
LPredicate<T> func)
From-To. Intended to be used with non-capturing lambda.
static <T> void times(int max_i,
T a,
LPredicate<T> func)
From-To. Intended to be used with non-capturing lambda.
default LPredicate untyped()
Cast that removes generics.
default <V2> LPredicate<V2> cast()
Cast that replace generics.
static <V2,T> LPredicate<V2> cast(LPredicate<T> function)
Cast that replace generics.
default LBoolSupplier capture(T a)
Captures arguments but delays the evaluation.
static <T> LPredicate<T> constant(boolean r)
Creates function that always returns the same value.
@Nonnull static <T> LPredicate<T> pred(@Nonnull LPredicate<T> lambda)
Convenient method in case lambda expression is ambiguous for the compiler (that might happen for overloaded methods accepting different interfaces).
@Nonnull static <T> LPredicate<T> recursive(@Nonnull LFunction<LPredicate<T>,LPredicate<T>> selfLambda)
@Nonnull static <T> LPredicate<T> predThrowing(@Nonnull ExF<Throwable> exF)
@Nonnull static <T> LPredicate<T> predThrowing(String message, @Nonnull ExMF<Throwable> exF)
static <T> boolean call(T a,
@Nonnull
LPredicate<T> lambda)
@Nonnull static <T> LPredicate<T> wrap(java.util.function.Predicate<T> other)
Wraps JRE instance.
@Nonnull static <T> LPredicate<T> safe()
Safe instance. That always returns the same value (as alwaysFalse).
@Nonnull static <T> LSupplier<LPredicate<T>> safeSupplier()
Safe instance supplier. Returns supplier of safe() instance.
@Nonnull static <T> LPredicate<T> safe(@Nullable LPredicate<T> other)
Safe wrapping. Either argument function is returned (if it is not null) or safe() instance.
@Nonnull static <T> LSupplier<LPredicate<T>> safeSupplier(@Nullable LSupplier<LPredicate<T>> supplier)
Safe supplier. Either argument supplier is returned (if it is not null) or supplier of safe() instance.
@Nonnull default LPredicate<T> negate()
Returns a predicate that represents the logical negation of this predicate.
negate in interface java.util.function.Predicate<T>java.util.function.Predicate#negate}@Nonnull default LPredicate<T> and(@Nonnull LPredicate<? super T> other)
Returns a predicate that represents the logical AND of evaluation of this predicate and the argument one.
java.util.function.Predicate#and()}@Nonnull default LPredicate<T> or(@Nonnull LPredicate<? super T> other)
Returns a predicate that represents the logical OR of evaluation of this predicate and the argument one.
java.util.function.Predicate#or}@Nonnull default LPredicate<T> xor(@Nonnull LPredicate<? super T> other)
Returns a predicate that represents the logical XOR of evaluation of this predicate and the argument one.
java.util.function.Predicate#or}@Nonnull static <T> LPredicate<T> isEqual(T target)
Creates predicate that evaluates if an object is equal with the argument one.
isEqual in interface java.util.function.Predicate<T>java.util.function.Predicate#isEqual()@Nonnull default <V> LPredicate<V> compose(@Nonnull LFunction<? super V,? extends T> before)
Allows to manipulate the domain of the function.
static <V,T> LPredicate<V> composed(@Nonnull LFunction<? super V,? extends T> before, LPredicate<T> after)
@Nonnull default <V> LFunction<T,V> boolToFunc(@Nonnull LBoolFunction<? extends V> after)
Combines two functions together in a order.
@Nonnull default LToByteFunction<T> boolToToByteFunc(@Nonnull LBoolToByteFunction after)
Combines two functions together in a order.
@Nonnull default LToSrtFunction<T> boolToToSrtFunc(@Nonnull LBoolToSrtFunction after)
Combines two functions together in a order.
@Nonnull default LToIntFunction<T> boolToToIntFunc(@Nonnull LBoolToIntFunction after)
Combines two functions together in a order.
@Nonnull default LToLongFunction<T> boolToToLongFunc(@Nonnull LBoolToLongFunction after)
Combines two functions together in a order.
@Nonnull default LToFltFunction<T> boolToToFltFunc(@Nonnull LBoolToFltFunction after)
Combines two functions together in a order.
@Nonnull default LToDblFunction<T> boolToToDblFunc(@Nonnull LBoolToDblFunction after)
Combines two functions together in a order.
@Nonnull default LToCharFunction<T> boolToToCharFunc(@Nonnull LBoolToCharFunction after)
Combines two functions together in a order.
@Nonnull default LPredicate<T> boolToPred(@Nonnull LLogicalOperator after)
Combines two functions together in a order.
static <T> boolean alwaysTrue(T a)
Returns TRUE.
static <T> boolean alwaysFalse(T a)
Returns FALSE.
default <C0> void filterForEach(IndexedRead<C0,aType.a<T>> ia, C0 source, LConsumer<? super T> consumer)
For each element (or tuple) from arguments, calls the consumer if predicate test passes. Thread safety, fail-fast, fail-safety of this method is not expected.
default <C0,I0> void filterIterate(SequentialRead<C0,I0,aType.a<T>> sa, C0 source, LConsumer<? super T> consumer)
For each element (or tuple) from arguments, calls the consumer if predicate test passes. Thread safety, fail-fast, fail-safety of this method depends highly on the arguments.
default <V,C0> int targetedForEach(V v,
IndexedRead<C0,aType.a<T>> ia,
C0 source,
LBiObjIntConsumer<V,T> consumer)
For each element (or tuple) from arguments, calls the consumer (with index) if predicate test passes. First argument is designated as ‘target’ object. Thread safety, fail-fast, fail-safety of this method is not expected.
default <V,C0,I0> int targetedIterate(V v,
SequentialRead<C0,I0,aType.a<T>> sa,
C0 source,
LBiObjIntConsumer<V,T> consumer)
For each element (or tuple) from arguments, calls the consumer (with index) if predicate test passes. First argument is designated as ‘target’ object. Thread safety, fail-fast, fail-safety of this method depends highly on the arguments.
default <V,C0> int tieForEach(V v,
IndexedRead<C0,aType.a<T>> ia,
C0 source,
LTieConsumer<V,T> consumer)
For each element (or tuple) from arguments, calls the consumer (with index) if predicate test passes. First argument is designated as ‘target’ object. Thread safety, fail-fast, fail-safety of this method is not expected.
default <V,C0,I0> int tieIterate(V v,
SequentialRead<C0,I0,aType.a<T>> sa,
C0 source,
LTieConsumer<V,T> consumer)
For each element (or tuple) from arguments, calls the consumer (with index) if predicate test passes. First argument is designated as ‘target’ object. Thread safety, fail-fast, fail-safety of this method depends highly on the arguments.
Copyright © 2019. All rights reserved.