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

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

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

import java.util.function.Function;

public class NonThrowingFunction implements Function {

    private final ThrowingFunction throwingFunction;

    public NonThrowingFunction(ThrowingFunction throwingFunction) {
        this.throwingFunction = throwingFunction;
    }

    @Override
    public R apply(T t) {
        try {
            return throwingFunction.apply(t);
        } catch (Exception e) {
            throw new CastledRuntimeException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy