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

com.github.fridujo.automocker.utils.ThrowingFunction Maven / Gradle / Ivy

The newest version!
package com.github.fridujo.automocker.utils;

import java.util.function.Function;

@FunctionalInterface
public interface ThrowingFunction {

    static  Function silent(ThrowingFunction throwing) {
        return silent(throwing, e -> {
            throw LamdaLuggageException.wrap(e);
        });
    }

    static  Function silent(ThrowingFunction throwing,
                                        Function errorHandler) {
        return t -> {
            try {
                return throwing.apply(t);
            } catch (Exception e) {
                return errorHandler.apply(e);
            }
        };
    }

    R apply(T t) throws Exception;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy