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

org.davidmoten.kool.function.Function Maven / Gradle / Ivy

There is a newer version: 0.1.35
Show newest version
package org.davidmoten.kool.function;

import org.davidmoten.kool.internal.util.Exceptions;
import org.davidmoten.kool.internal.util.StreamUtils;

@FunctionalInterface
public interface Function {

    R apply(T t) throws Exception;

    default R applyUnchecked(T t) {
        try {
            return apply(t);
        } catch (Exception e) {
            return Exceptions.rethrow(e);
        }
    }

    @SuppressWarnings("unchecked")
    public static  Function identity() {
        return (Function) StreamUtils.FunctionIdentityHolder.IDENTITY;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy