Java Code Examples for io.reactivex.Observable.reduce()

The following are Jave code examples for showing how to use reduce() of the io.reactivex.Observable class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: buckaroo   File: Process.java   Source Code and License Vote up 4 votes
public static <S, T> Maybe<Process<S, T>> max(final Observable<Process<S, T>> xs, final Comparator<T> comparator) {
    Objects.requireNonNull(xs, "xs is null");
    Objects.requireNonNull(comparator, "comparator is null");
    return xs.reduce((state, next) -> Process.max(state, next, comparator));
}
 
Example 2
Project: buckaroo   File: MoreObservables.java   Source Code and License Vote up 4 votes
@Deprecated
public static <T> Maybe<T> findMax(final Observable<T> xs, final Comparator<T> comparator) {
    Preconditions.checkNotNull(xs);
    Preconditions.checkNotNull(comparator);
    return xs.reduce((x, y) -> (comparator.compare(x, y) < 0) ? y : x);
}