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

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

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

import java.util.function.Predicate;

@FunctionalInterface
public interface UncheckedPredicate {

    boolean test(T t) throws Throwable;

    static  Predicate of(UncheckedPredicate predicate) {
        return t -> {
            try {
                return predicate.test(t);
            } catch (Throwable e) {
                if (e instanceof RuntimeException) {
                    throw (RuntimeException) e;
                }
                throw new RuntimeException(e);
            }
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy