
jedi.functors.ConstantFunctor0 Maven / Gradle / Ivy
The newest version!
package jedi.functors;
import jedi.functional.Functor0;
/**
* A {@link Functor0} that returns a constant.
*/
public class ConstantFunctor0 implements Functor0 {
private final R c;
/**
* A convenient factory to create a constant functor.
* @param constant
* @param
* @return a functor that will always return constant
*/
public static ConstantFunctor0 constant(R constant) {
return new ConstantFunctor0(constant);
}
/**
* @see #constant(Object)
*/
public static ConstantFunctor0 constantFunctor0(R constant) {
return constant(constant);
}
public ConstantFunctor0(R constant) {
this.c = constant;
}
public R execute() {
return c;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy