FailablePredicate

@FunctionalInterface public abstract interface org.apache.commons.lang3.function.FailablePredicate<T, E extends Throwable>[source]

A functional interface like Predicate that declares a Throwable.

Parameters:
  • <T> – Predicate type.

  • <E> – The kind of thrown exception or error.

Since:

3.11

Fields and constants

FALSE

FALSE singleton

TRUE

TRUE singleton

@SuppressWarnings({"rawtypes"}) public static final FailablePredicate FALSE[source]

FALSE singleton

@SuppressWarnings({"rawtypes"}) public static final FailablePredicate TRUE[source]

TRUE singleton

Methods

and(FailablePredicate)

Returns a composed FailablePredicate like Predicate#and(Predicate).

falsePredicate()

Gets the FALSE singleton.

negate()

Returns a predicate that negates this predicate.

or(FailablePredicate)

Returns a composed FailablePredicate like Predicate#and(Predicate).

test(Object)

Tests the predicate.

truePredicate()

Gets the TRUE singleton.

public default FailablePredicate<T, E> and(FailablePredicate<? super T, E> other)[source]

Returns a composed FailablePredicate like Predicate#and(Predicate).

Parameters:

other – A predicate that will be logically-ANDed with this predicate.

Returns:

A composed FailablePredicate like Predicate#and(Predicate).

Throws:

java.lang.NullPointerException – Thrown if other is null.

@SuppressWarnings({"unchecked"}) public static <T, E extends Throwable> FailablePredicate<T, E> falsePredicate()[source]

Gets the FALSE singleton.

Type parameters:
  • <T> – Predicate type.

  • <E> – The kind of thrown exception or error.

Returns:

The NOP singleton.

public default FailablePredicate<T, E> negate()[source]

Returns a predicate that negates this predicate.

Returns:

A predicate that negates this predicate.

public default FailablePredicate<T, E> or(FailablePredicate<? super T, E> other)[source]

Returns a composed FailablePredicate like Predicate#and(Predicate).

Parameters:

other – A predicate that will be logically-ORed with this predicate.

Returns:

A composed FailablePredicate like Predicate#and(Predicate).

Throws:

java.lang.NullPointerException – Thrown if other is null.

public abstract boolean test(T object) throws E[source]

Tests the predicate.

Parameters:

object – The object to test the predicate on

Returns:

The predicate’s evaluation

Throws:

E – Thrown if the predicate fails.

@SuppressWarnings({"unchecked"}) public static <T, E extends Throwable> FailablePredicate<T, E> truePredicate()[source]

Gets the TRUE singleton.

Type parameters:
  • <T> – Predicate type.

  • <E> – The kind of thrown exception or error.

Returns:

The NOP singleton.