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

eu.lucaventuri.common.FunctionEx Maven / Gradle / Ivy

There is a newer version: 3.0.1
Show newest version
package eu.lucaventuri.common;

import java.util.Objects;

/** Funcntion that can throw an exception */
@FunctionalInterface
public interface FunctionEx {
    R apply(T t) throws E;

    default  FunctionEx compose(java.util.function.Function before) throws E {
        Objects.requireNonNull(before);

        return (V v) -> apply(before.apply(v));
    }

    default  FunctionEx andThen(java.util.function.Function after) {
        Objects.requireNonNull(after);
        return (T t) -> after.apply(apply(t));
    }

    static  FunctionEx identity() {
        return t -> t;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy