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

cn.mybatisboost.util.function.UncheckedFunction Maven / Gradle / Ivy

The newest version!
package cn.mybatisboost.util.function;

import java.util.function.Function;

@FunctionalInterface
public interface UncheckedFunction {

    R apply(T t) throws Throwable;

    static  Function of(UncheckedFunction function) {
        return t -> {
            try {
                return function.apply(t);
            } catch (Throwable e) {
                if (e instanceof RuntimeException) {
                    throw (RuntimeException) e;
                }
                throw new RuntimeException(e);
            }
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy