com.jnape.palatable.lambda.functions.builtin.fn2.Partial3 Maven / Gradle / Ivy
package com.jnape.palatable.lambda.functions.builtin.fn2;
import com.jnape.palatable.lambda.functions.Fn1;
import com.jnape.palatable.lambda.functions.Fn2;
import com.jnape.palatable.lambda.functions.Fn3;
/**
* Partially apply (fix) the first argument of a Fn3
, producing a Fn2
that takes the remaining
* two argument. This is isomorphic to calling {@link Fn3#apply(Object)}.
*
* @param The type of the value to be supplied
* @param The first input argument type of the resulting function
* @param The second input argument type of the resulting function
* @param The return type of the resulting function
* @see Partial2
*/
public final class Partial3 implements Fn2, A, Fn2> {
private Partial3() {
}
@Override
public Fn2 apply(Fn3 fn, A a) {
return fn.apply(a);
}
public static Partial3 partial3() {
return new Partial3<>();
}
public static Fn1> partial3(Fn3 fn) {
return Partial3.partial3().apply(fn);
}
public static Fn2 partial3(Fn3 fn, A a) {
return partial3(fn).apply(a);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy