@FunctionalInterface
@Generated(value="uk.kludje.annotation.processor.UncheckedFunctionalInterfaceProcessor")
public interface UIntPredicate
extends java.util.function.IntPredicate
boolean $test(int arg0) throws Throwable USING A LAMBDA; INVOKE boolean test(int arg0).
A functional interface for handling checked exceptions. See parent type for interface intent.
boolean test(int arg0) invokes boolean $test(int arg0)
and throws anything thrown by boolean $test(int arg0).
General example using java.lang.Runnable that reduces 11 lines to a single line.
Call someMethodThatThrowsException in throwsNothing:
public void someMethodThatThrowsException() throws IOException {
// I/O functionality
}
public void throwsNothing(Runnable r) {
r.run();
}
Before:
public void yourMethod() throws IOException {
try {
throwsNothing(() -> {
try {
someMethodThatThrowsException();
} catch (IOException e) {
throw new SomeWrapperException(e);
}
});
} catch(SomeWrapperException w) {
throw (IOException) w.getCause();
}
}
After:
public void yourMethod() throws IOException {
throwsNothing((URunnable) this::someMethodThatThrowsException);
}
Method public static UIntPredicate asUIntPredicate(UIntPredicate t)
provides a convenience method for manufacturing types as an alternative to casting.
| Modifier and Type | Method and Description |
|---|---|
boolean |
$test(int arg0) |
static UIntPredicate |
asUIntPredicate(UIntPredicate t) |
default boolean |
test(int arg0) |
default boolean test(int arg0)
test in interface java.util.function.IntPredicateboolean $test(int arg0)
throws java.lang.Throwable
java.lang.Throwablestatic UIntPredicate asUIntPredicate(UIntPredicate t)