com.jnape.palatable.lambda.functions.builtin.fn2.Tupler2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lambda Show documentation
Show all versions of lambda Show documentation
Functional patterns for Java
package com.jnape.palatable.lambda.functions.builtin.fn2;
import com.jnape.palatable.lambda.adt.hlist.Tuple2;
import com.jnape.palatable.lambda.functions.Fn1;
import com.jnape.palatable.lambda.functions.Fn2;
import static com.jnape.palatable.lambda.adt.hlist.HList.tuple;
/**
* Creates a Tuple2
from two values.
*
* @param The type of the first value; also the first slot type of returned Tuple2
* @param The type of the second value; also the second slot type of returned Tuple2
* @see com.jnape.palatable.lambda.adt.hlist.Tuple2
*/
public final class Tupler2 implements Fn2> {
private Tupler2() {
}
@Override
public Tuple2 apply(A a, B b) {
return tuple(a, b);
}
public static Tupler2 tupler() {
return new Tupler2<>();
}
public static Fn1> tupler(A a) {
return Tupler2.tupler().apply(a);
}
public static Tuple2 tupler(A a, B b) {
return Tupler2.tupler(a).apply(b);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy