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

io.windmill.core.tasks.Task2 Maven / Gradle / Ivy

There is a newer version: 0.2
Show newest version
package io.windmill.core.tasks;

@FunctionalInterface
public interface Task2
{
    O compute(I1 i1, I2 i2);

    /**
     * @see Currying
     *
     * @return current task in the curried form
     */
    default Task1> curried()
    {
        return i1 -> i2 -> compute(i1, i2);
    }

    /**
     * @return a new task that reverses the input order
     */
    default Task2 flip()
    {
        return (i2, i1) -> compute(i1, i2);
    }

    /**
     * Fixes the first argument and returns another task that represents the second argument.
     *
     * @param i1 The value of the first argument
     *
     * @return new task with fixed first argument
     */
    default Task1 partialApply(I1 i1)
    {
        return i2 -> compute(i1, i2);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy