net.openhft.chronicle.testframework.function.NamedConsumer Maven / Gradle / Ivy
package net.openhft.chronicle.testframework.function;
import net.openhft.chronicle.testframework.internal.VanillaNamedConsumer;
import java.util.function.Consumer;
import static java.util.Objects.requireNonNull;
public interface NamedConsumer extends HasName, Consumer {
static NamedConsumer of(final Consumer consumer,
final String name) {
requireNonNull(consumer);
requireNonNull(name);
return new VanillaNamedConsumer<>(consumer, name);
}
static NamedConsumer ofThrowing(final ThrowingConsumer consumer,
final String name) {
return of(ThrowingConsumer.of(consumer), name);
}
}