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

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

package net.mintern.functions.unary.checked;

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

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

    /**
     * Binds {@code (t)} to {@code f}, returning a new function
     * of type {@code () -> short}.
     *
     * @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 () -> short} that calls
     *      {@code f.call(t)} and returns the result.
     */
    static  net.mintern.functions.nullary.checked.NilToShortE
    bind(ObjToShortE f, T t) {
        return () -> f.call(t);
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy