![JAR search and dependency download from the Maven repository](/logo.png)
co.pragmati.function.throwing.ThrowingConsumer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of func-commons Show documentation
Show all versions of func-commons Show documentation
Java 8 common library with extended functions
The newest version!
package co.pragmati.function.throwing;
import java.util.Objects;
import java.util.function.Consumer;
/**
* Consumer that throws exceptions
* @param
* @param
*
* @author jmbataller
*/
@FunctionalInterface
interface ThrowingConsumer {
/**
* Performs operation on the given argument
*
* @param t
* @throws E
*/
void accept(T t) throws E;
default ThrowingConsumer andThen(ThrowingConsumer super T, ? extends E> after) {
Objects.requireNonNull(after);
return (T t) -> {
accept(t);
after.accept(t);
};
}
default ThrowingConsumer andThen(Consumer super T> after) throws E {
Objects.requireNonNull(after);
return (T t) -> {
accept(t);
after.accept(t);
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy