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

io.castled.exceptions.NonThrowingConsumer Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package io.castled.exceptions;


import io.castled.functionalinterfaces.ThrowingConsumer;

import java.util.function.Consumer;

public class NonThrowingConsumer implements Consumer {

    private final ThrowingConsumer throwingConsumer;

    public NonThrowingConsumer(ThrowingConsumer throwingConsumer) {
        this.throwingConsumer = throwingConsumer;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy