/** * Return the test for this user case or for the other. there is no guarantee * one successful result will be produced. * * @param orCase the case bo be tested in case this one fail. * @return a composite case to perform a XOR operation. */ default Case<T, R> or(Case<T, R> orCase) { return (t) -> { Option<R> val = test(t); return val.isPresent() ? val : orCase.test(t); }; }
public <R> R with(Case<T, R> case1, Any<T, R> any) { return case1.test(value).orElseGet(() -> any.apply(value)); }
@SafeVarargs public final <R> Option<R> with(Case<T, R>... cases) { return ReactiveSeq.of(cases).foldLeft(Case::or).flatMap(c -> c.test(value)); }
public <R> R with(Case<T, R> case1, Case<T, R> case2, Any<T, R> any) { return case1.or(case2).test(value).orElseGet(() -> any.apply(value)); }
/** * Return the test for this user case or for the other. there is no guarantee * one successful result will be produced. * * @param orCase the case bo be tested in case this one fail. * @return a composite case to perform a XOR operation. */ default Case<T, R> or(Case<T, R> orCase) { return (t) -> { Option<R> val = test(t); return val.isPresent() ? val : orCase.test(t); }; }
@SafeVarargs public final <R> Option<R> with(Case<T, R>... cases) { return ReactiveSeq.of(cases).foldLeft(Case::or).flatMap(c -> c.test(value)); }
public <R> R with(Case<T, R> case1, Any<T, R> any) { return case1.test(value).orElseGet(() -> any.apply(value)); }
public <R> R with(Case<T, R> case1, Case<T, R> case2, Any<T, R> any) { return case1.or(case2).test(value).orElseGet(() -> any.apply(value)); }