fj.function.Visitor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionaljava Show documentation
Show all versions of functionaljava Show documentation
Functional Java is an open source library that supports closures for the Java programming language
package fj.function;
import fj.Equal;
import fj.F;
import fj.F0;
import fj.Function;
import fj.Monoid;
import fj.P1;
import fj.P2;
import fj.data.List;
import fj.data.Option;
import static fj.Function.compose;
import static fj.Function.curry;
import static fj.data.List.lookup;
/**
* The essence of the visitor design pattern expressed polymorphically.
*
* @version %build.number%
*/
public final class Visitor {
private Visitor() {
throw new UnsupportedOperationException();
}
/**
* Returns the first value available in the given list of optional values. If none is found return the given default value.
*
* @param values The optional values to search.
* @param def The default value if no value is found in the list.
* @return The first value available in the given list of optional values. If none is found return the given default value.
*/
public static X findFirst(final List