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

com.jnape.palatable.lambda.functions.builtin.fn2.Tupler2 Maven / Gradle / Ivy

There is a newer version: 5.5.0
Show newest version
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