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

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

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

import net.openhft.chronicle.testframework.function.ThrowingConsumer;
import net.openhft.chronicle.testframework.function.ThrowingConsumerException;

import java.util.function.Consumer;

import static java.util.Objects.requireNonNull;

public final class VanillaThrowingConsumer implements Consumer {

    private final ThrowingConsumer delegate;

    public VanillaThrowingConsumer(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