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

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

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

import java.util.function.Consumer;

@FunctionalInterface
public interface UncheckedConsumer {

    void accept(T t) throws Throwable;

    static  Consumer of(UncheckedConsumer consumer) {
        return t -> {
            try {
                consumer.accept(t);
            } catch (Throwable e) {
                if (e instanceof RuntimeException) {
                    throw (RuntimeException) e;
                }
                throw new RuntimeException(e);
            }
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy