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

net.mintern.functions.unary.checked.ObjToFloatE Maven / Gradle / Ivy

The newest version!
package net.mintern.functions.unary.checked;

/**
 * An operation of type {@code (T) -> float}.
 *
 * @param  the type of argument 1
 * @param  the {@code Exception} type that the operation may throw
 */
@FunctionalInterface
public interface ObjToFloatE {

    /**
     * Performs this operation.
     *
     * @param t the argument
     * @return the result of the operation
     * @throws E if the operation cannot be completed
     */
    float call(T t) throws E;

    /**
     * Binds {@code (t)} to {@code f}, returning a new function
     * of type {@code () -> float}.
     *
     * @param  the type of argument 1
     * @param  the {@code Exception} type that the operation may throw
     * @param f the unbound function
     * @param t the argument
     * @return a new function {@code () -> float} that calls
     *      {@code f.call(t)} and returns the result.
     */
    static  net.mintern.functions.nullary.checked.NilToFloatE
    bind(ObjToFloatE f, T t) {
        return () -> f.call(t);
    }

    /**
     * Binds {@code (t)} to {@code this}, returning a new function
     * of type {@code () -> float}.
     *
     * @param t the argument
     * @return a new function {@code () -> float} that calls
     *      {@code this.call(t)} and returns the result.
     */
    default net.mintern.functions.nullary.checked.NilToFloatE bind(T t) {
        return ObjToFloatE.bind(this, t);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy