Top Description Methods
org.osgi.util.function

public Interface Predicate<T>

Annotations
@ConsumerType
@FunctionalInterface
Type Parameters
<T>
The type of the predicate input.
Static Imports
java.util.Objects.requireNonNull

A predicate that accepts a single argument and produces a boolean result.

This is a functional interface and can be used as the assignment target for a lambda expression or method reference.

Author
$Id: 9b23069d1debb3fe36f4a6040b65a583b7a37d1a $

Method Summary

Modifier and TypeMethod and Description
public default Predicate<T>

Returns:

A Predicate composed of this Predicate and the specified Predicate using logical-AND.
and
(Predicate<? super T>
The Predicate to be called after this Predicate is called. Must not be null.
and
)

Compose this Predicate logical-AND the specified Predicate.

public static <
The type of the predicate input.
T
>
Predicate<T>

Returns:

A java.util.function.Predicate which wraps the specified Predicate.
asJavaPredicate
(Predicate<T>
The Predicate to wrap. Must not be null.
wrapped
)

Returns a java.util.function.Predicate which wraps the specified Predicate and throws any thrown exceptions.

public static <
The type of the predicate input.
T
>
Predicate<T>

Returns:

A java.util.function.Predicate which wraps the specified Predicate and the specified value.
asJavaPredicateOrElse
(Predicate<T>
The Predicate to wrap. Must not be null.
wrapped
,
boolean
The value to return if the specified Predicate throws an Exception.
orElse
)

Returns a java.util.function.Predicate which wraps the specified Predicate and the specified value.

public static <
The type of the predicate input.
T
>
Predicate<T>

Returns:

A java.util.function.Predicate which wraps the specified Predicate and the specified java.util.function.BooleanSupplier.
asJavaPredicateOrElseGet
(Predicate<T>
The Predicate to wrap. Must not be null.
wrapped
,
BooleanSupplier
The java.util.function.BooleanSupplier to call for a return value if the specified Predicate throws an Exception.
orElseGet
)

Returns a java.util.function.Predicate which wraps the specified Predicate and the specified java.util.function.BooleanSupplier.

public static <
The type of the predicate input.
T
>
Predicate<T>

Returns:

A Predicate which wraps the specified java.util.function.Predicate.
asPredicate
(Predicate<T>
The java.util.function.Predicate to wrap. Must not be null.
wrapped
)

Returns a Predicate which wraps the specified java.util.function.Predicate.

public default Predicate<T>

Returns:

A Predicate which is the negation of this Predicate.
negate
()

Return a Predicate which is the negation of this Predicate.

public default Predicate<T>

Returns:

A Predicate composed of this Predicate and the specified Predicate using logical-OR.
or
(Predicate<? super T>
The Predicate to be called after this Predicate is called. Must not be null.
or
)

Compose this Predicate logical-OR the specified Predicate.

public boolean

Returns:

true if the specified argument is accepted by this predicate; false otherwise.
test
(T
The input to this predicate.
t
)

Evaluates this predicate on the specified argument.

Method Detail

andback to summary
public default Predicate<T> and(Predicate<? super T> and)

Compose this Predicate logical-AND the specified Predicate.

Short-circuiting is used, so the specified Predicate is not called if this Predicate returns false.

Parameters
and:Predicate<? super T>

The Predicate to be called after this Predicate is called. Must not be null.

Returns:Predicate<T>

A Predicate composed of this Predicate and the specified Predicate using logical-AND.

asJavaPredicateback to summary
public static <T> Predicate<T> asJavaPredicate(Predicate<T> wrapped)

Returns a java.util.function.Predicate which wraps the specified Predicate and throws any thrown exceptions.

The returned java.util.function.Predicate will throw any exception thrown by the wrapped Predicate.

Parameters
<T>
The type of the predicate input.
wrapped:Predicate<T>

The Predicate to wrap. Must not be null.

Returns:Predicate<T>

A java.util.function.Predicate which wraps the specified Predicate.

asJavaPredicateOrElseback to summary
public static <T> Predicate<T> asJavaPredicateOrElse(Predicate<T> wrapped, boolean orElse)

Returns a java.util.function.Predicate which wraps the specified Predicate and the specified value.

If the the specified Predicate throws an Exception, the the specified value is returned.

Parameters
<T>
The type of the predicate input.
wrapped:Predicate<T>

The Predicate to wrap. Must not be null.

orElse:boolean

The value to return if the specified Predicate throws an Exception.

Returns:Predicate<T>

A java.util.function.Predicate which wraps the specified Predicate and the specified value.

asJavaPredicateOrElseGetback to summary
public static <T> Predicate<T> asJavaPredicateOrElseGet(Predicate<T> wrapped, BooleanSupplier orElseGet)

Returns a java.util.function.Predicate which wraps the specified Predicate and the specified java.util.function.BooleanSupplier.

If the the specified Predicate throws an Exception, the value returned by the specified java.util.function.BooleanSupplier is returned.

Parameters
<T>
The type of the predicate input.
wrapped:Predicate<T>

The Predicate to wrap. Must not be null.

orElseGet:BooleanSupplier

The java.util.function.BooleanSupplier to call for a return value if the specified Predicate throws an Exception.

Returns:Predicate<T>

A java.util.function.Predicate which wraps the specified Predicate and the specified java.util.function.BooleanSupplier.

asPredicateback to summary
public static <T> Predicate<T> asPredicate(Predicate<T> wrapped)

Returns a Predicate which wraps the specified java.util.function.Predicate.

Parameters
<T>
The type of the predicate input.
wrapped:Predicate<T>

The java.util.function.Predicate to wrap. Must not be null.

Returns:Predicate<T>

A Predicate which wraps the specified java.util.function.Predicate.

negateback to summary
public default Predicate<T> negate()

Return a Predicate which is the negation of this Predicate.

Returns:Predicate<T>

A Predicate which is the negation of this Predicate.

orback to summary
public default Predicate<T> or(Predicate<? super T> or)

Compose this Predicate logical-OR the specified Predicate.

Short-circuiting is used, so the specified Predicate is not called if this Predicate returns true.

Parameters
or:Predicate<? super T>

The Predicate to be called after this Predicate is called. Must not be null.

Returns:Predicate<T>

A Predicate composed of this Predicate and the specified Predicate using logical-OR.

testback to summary
public boolean test(T t) throws Exception

Evaluates this predicate on the specified argument.

Parameters
t:T

The input to this predicate.

Returns:boolean

true if the specified argument is accepted by this predicate; false otherwise.

Exceptions
Exception:
An exception thrown by the method.