Interface ThrowingPredicate<T>
- Type Parameters:
T- type of the input element
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
This functional interface allows to not catch an Exception in a
lambda expression : use it at your own risk, the exception
becomes unchecked.
It is recommended to use it only in a method that can throw the
Exception type that is unchecked. So the exception can be
checked when using the method.
Source : http://4comprehension.com/sneakily-throwing-exceptions-in-lambda-expressions-in-java/
-
Method Summary
Modifier and TypeMethodDescriptionbooleanRedefine the accept method to be able to declare that an exception is thrownstatic <T> Predicate<T> unchecked(ThrowingPredicate<T> c) Wraps a throwing predicate into a standard unchecked predicate.
-
Method Details
-
test
-
unchecked
Wraps a throwing predicate into a standard unchecked predicate.- Type Parameters:
T- type of the input element- Parameters:
c- the consumer to call- Returns:
- the consumer result
-