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

com.blade.jdbc.utils.Unchecked Maven / Gradle / Ivy

There is a newer version: 0.2.2-RELEASE
Show newest version
package com.blade.jdbc.utils;

import java.util.concurrent.Callable;
import java.util.function.Consumer;

/**
 * Created by biezhi on 03/07/2017.
 */
public class Unchecked {

    public static  T wrap(Callable callable) {
        try {
            return callable.call();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static  void wrap(T t, Consumer consumer) {
        try {
            consumer.accept(t);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy