com.jnape.palatable.lambda.functions.builtin.fn1.Constantly 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.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