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

com.jnape.palatable.lambda.functions.builtin.fn1.Constantly Maven / Gradle / Ivy

There is a newer version: 5.5.0
Show newest version
package com.jnape.palatable.lambda.functions.builtin.fn1;

import com.jnape.palatable.lambda.functions.Fn1;
import com.jnape.palatable.lambda.functions.Fn2;

/**
 * A function that takes two arguments and always returns the first argument.
 *
 * @param  The first argument type, and the the function's return type
 * @param  The second (ignored) argument type
 */
public final class Constantly implements Fn2 {

    private Constantly() {
    }

    @Override
    public A apply(A a, B b) {
        return a;
    }

    public static  Constantly constantly() {
        return new Constantly<>();
    }

    public static  Fn1 constantly(A a) {
        return Constantly.constantly().apply(a);
    }

    public static  A constantly(A a, B b) {
        return constantly(a).apply(b);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy