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

co.pragmati.function.unchecked.UncheckedFunction Maven / Gradle / Ivy

package co.pragmati.function.unchecked;

import java.util.function.Function;

/**
 * Function that throws unchecked exceptions
 * @param 
 * @param 
 *
 * @author jmbataller
 */
@FunctionalInterface
public interface UncheckedFunction extends Function {

    R applyThrows(T t) throws Exception;

    @Override
    default R apply(T t) {
        try {
            return applyThrows(t);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy