@FunctionalInterface
@Generated(value="uk.kludje.annotation.processor.UncheckedFunctionalInterfaceProcessor")
public interface UObjDoubleConsumer<T>
extends java.util.function.ObjDoubleConsumer<T>
void $accept(T arg0, double arg1) throws Throwable USING A LAMBDA; INVOKE void accept(T arg0, double arg1).
A functional interface for handling checked exceptions. See parent type for interface intent.
void accept(T arg0, double arg1) invokes void $accept(T arg0, double arg1)
and throws anything thrown by void $accept(T arg0, double arg1).
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 <T> UObjDoubleConsumer<T> asUObjDoubleConsumer(UObjDoubleConsumer<T> t)
provides a convenience method for manufacturing types as an alternative to casting.
| Modifier and Type | Method and Description |
|---|---|
void |
$accept(T arg0,
double arg1) |
default void |
accept(T arg0,
double arg1) |
static <T> UObjDoubleConsumer<T> |
asUObjDoubleConsumer(UObjDoubleConsumer<T> t) |
default void accept(T arg0, double arg1)
accept in interface java.util.function.ObjDoubleConsumer<T>void $accept(T arg0, double arg1) throws java.lang.Throwable
java.lang.Throwablestatic <T> UObjDoubleConsumer<T> asUObjDoubleConsumer(UObjDoubleConsumer<T> t)