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

net.openhft.chronicle.testframework.internal.function.VanillaThrowingConsumer Maven / Gradle / Ivy

There is a newer version: 2.27ea0
Show newest version
package net.openhft.chronicle.testframework.internal.function;

import net.openhft.chronicle.testframework.function.ThrowingConsumer;
import net.openhft.chronicle.testframework.function.ThrowingConsumerException;
import org.jetbrains.annotations.NotNull;

import java.util.function.Consumer;

import static java.util.Objects.requireNonNull;

public final class VanillaThrowingConsumer implements Consumer {

    private final ThrowingConsumer delegate;

    public VanillaThrowingConsumer(@NotNull final ThrowingConsumer delegate) {
        this.delegate = requireNonNull(delegate);
    }

    @Override
    public void accept(T t) {
        try {
            delegate.accept(t);
        } catch (Exception e) {
            throw new ThrowingConsumerException(e);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy