strolch/utils/src/main/java/li/strolch/utils/ThrowingConsumer.java

19 lines
345 B
Java

package li.strolch.utils;
import java.util.function.Consumer;
@FunctionalInterface
public interface ThrowingConsumer<T> extends Consumer<T> {
@Override
default void accept(final T elem) {
try {
acceptThrows(elem);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
void acceptThrows(T elem) throws Exception;
}