public final class Visitor
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <A,B> F<B,F<A,B>> |
association(List<P2<A,B>> x,
Equal<A> eq)
Uses an association list to perform a lookup with equality and returns a function that can be applied to a default,
followed by the associated key to return a value.
|
static <A,B> F<P1<B>,F<A,B>> |
associationLazy(List<P2<A,B>> x,
Equal<A> eq)
Uses an association list to perform a lookup with equality and returns a function that can be applied to a default,
followed by the associated key to return a value.
|
static <X> X |
findFirst(List<Option<X>> values,
F0<X> def)
Returns the first value available in the given list of optional values.
|
static <X> X |
nullablefindFirst(List<X> values,
F0<X> def)
Returns the first non-
null value in the given list of optional values. |
static <A,B> B |
nullableVisitor(List<F<A,B>> visitors,
F0<B> def,
A value)
Returns the first non-
null value found in the list of visitors after application of the given value,
otherwise returns the given default. |
static <A,B> B |
visitor(List<F<A,Option<B>>> visitors,
F0<B> def,
A value)
Returns the first value found in the list of visitors after application of the given value, otherwise returns the
given default.
|
public static <X> X findFirst(List<Option<X>> values, F0<X> def)
values
- The optional values to search.def
- The default value if no value is found in the list.public static <X> X nullablefindFirst(List<X> values, F0<X> def)
null
value in the given list of optional values. If none is found return the given default value.values
- The potentially null
values to search.def
- The default value if no value is found in the list.null
value in the given list of optional values. If none is found return the given default value.public static <A,B> B visitor(List<F<A,Option<B>>> visitors, F0<B> def, A value)
visitors
- The list of visitors to apply.def
- The default if none of the visitors yield a value.value
- The value to apply to the visitors.public static <A,B> B nullableVisitor(List<F<A,B>> visitors, F0<B> def, A value)
null
value found in the list of visitors after application of the given value,
otherwise returns the given default.visitors
- The list of visitors to apply looking for a non-null
.def
- The default if none of the visitors yield a non-null
value.value
- The value to apply to the visitors.public static <A,B> F<B,F<A,B>> association(List<P2<A,B>> x, Equal<A> eq)
x
- The association list.eq
- The equality for the association list keys.public static <A,B> F<P1<B>,F<A,B>> associationLazy(List<P2<A,B>> x, Equal<A> eq)
x
- The association list.eq
- The equality for the association list keys.