public final class PredicateUtil
extends Object
Method Summary
All Methods Static Methods Concrete Methods
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
Method Details
andLog
A method that tests a
Predicate
and perform the given
Consumer
's action on the
class logger if the
Predicate
test returns
false
.
Can be used to log messages when filtering on an
Optional
.
Example:
.filter(andLog(p -> !p.isUnlimited(), logger -> logger.warn("message)))
Type Parameters:
T
- The type of the predicate.
Parameters:
predicate
- The Predicate
to test.
loggerAction
- The Consumer
action to accept if the previous predicate is false
to
display the message on the current logger.
Returns:
The Predicate
result.