All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codefilarete.tool.function.ThrowingConsumer Maven / Gradle / Ivy

package org.codefilarete.tool.function;

import java.util.Objects;
import java.util.function.Consumer;

/**
 * @author Guillaume Mary
 */
@FunctionalInterface
public interface ThrowingConsumer {
	
	/**
	 * Performs this operation on the given argument.
	 *
	 * @param t the input argument
	 */
	void accept(T t) throws E;
	
	default ThrowingConsumer andThen(Consumer after) {
		Objects.requireNonNull(after);
		return (T t) -> { accept(t); after.accept(t); };
	}
	
	default ThrowingConsumer andThen(ThrowingConsumer after) {
		Objects.requireNonNull(after);
		return (T t) -> { accept(t); after.accept(t); };
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy