RxJava



rx.observables
Class MathObservable<T>

java.lang.Object
  extended by rx.observables.MathObservable<T>

public class MathObservable<T>
extends java.lang.Object


Method Summary
 rx.Observable<java.lang.Double> averageDouble(rx.functions.Func1<? super T,java.lang.Double> valueExtractor)
          Returns an Observable that transforms items emitted by the source Observable into Doubles by using a function you provide and then emits the Double average of the complete sequence of transformed values.
static rx.Observable<java.lang.Double> averageDouble(rx.Observable<java.lang.Double> source)
          Returns an Observable that emits the average of the Doubles emitted by the source Observable.
 rx.Observable<java.lang.Float> averageFloat(rx.functions.Func1<? super T,java.lang.Float> valueExtractor)
          Returns an Observable that transforms items emitted by the source Observable into Floats by using a function you provide and then emits the Float average of the complete sequence of transformed values.
static rx.Observable<java.lang.Float> averageFloat(rx.Observable<java.lang.Float> source)
          Returns an Observable that emits the average of the Floats emitted by the source Observable.
 rx.Observable<java.lang.Integer> averageInteger(rx.functions.Func1<? super T,java.lang.Integer> valueExtractor)
          Returns an Observable that transforms items emitted by the source Observable into Integers by using a function you provide and then emits the Integer average of the complete sequence of transformed values.
static rx.Observable<java.lang.Integer> averageInteger(rx.Observable<java.lang.Integer> source)
          Returns an Observable that emits the average of the Integers emitted by the source Observable.
 rx.Observable<java.lang.Long> averageLong(rx.functions.Func1<? super T,java.lang.Long> valueExtractor)
          Returns an Observable that transforms items emitted by the source Observable into Longs by using a function you provide and then emits the Long average of the complete sequence of transformed values.
static rx.Observable<java.lang.Long> averageLong(rx.Observable<java.lang.Long> source)
          Returns an Observable that emits the average of the Longs emitted by the source Observable.
static
<T> MathObservable<T>
from(rx.Observable<T> o)
           
 rx.Observable<T> max(java.util.Comparator<? super T> comparator)
          Returns an Observable that emits the maximum item emitted by the source Observable, according to the specified comparator.
static
<T extends java.lang.Comparable<? super T>>
rx.Observable<T>
max(rx.Observable<T> source)
          Returns an Observable that emits the single item emitted by the source Observable with the maximum numeric value.
 rx.Observable<T> min(java.util.Comparator<? super T> comparator)
          Returns an Observable that emits the minimum item emitted by the source Observable, according to a specified comparator.
static
<T extends java.lang.Comparable<? super T>>
rx.Observable<T>
min(rx.Observable<T> source)
          Returns an Observable that emits the single numerically minimum item emitted by the source Observable.
 rx.Observable<java.lang.Double> sumDouble(rx.functions.Func1<? super T,java.lang.Double> valueExtractor)
          Returns an Observable that extracts a Double from each of the items emitted by the source Observable via a function you specify, and then emits the sum of these Doubles.
static rx.Observable<java.lang.Double> sumDouble(rx.Observable<java.lang.Double> source)
          Returns an Observable that emits the sum of all the Doubles emitted by the source Observable.
 rx.Observable<java.lang.Float> sumFloat(rx.functions.Func1<? super T,java.lang.Float> valueExtractor)
          Returns an Observable that extracts a Float from each of the items emitted by the source Observable via a function you specify, and then emits the sum of these Floats.
static rx.Observable<java.lang.Float> sumFloat(rx.Observable<java.lang.Float> source)
          Returns an Observable that emits the sum of all the Floats emitted by the source Observable.
 rx.Observable<java.lang.Integer> sumInteger(rx.functions.Func1<? super T,java.lang.Integer> valueExtractor)
          Returns an Observable that extracts an Integer from each of the items emitted by the source Observable via a function you specify, and then emits the sum of these Integers.
static rx.Observable<java.lang.Integer> sumInteger(rx.Observable<java.lang.Integer> source)
          Returns an Observable that emits the sum of all the Integers emitted by the source Observable.
 rx.Observable<java.lang.Long> sumLong(rx.functions.Func1<? super T,java.lang.Long> valueExtractor)
          Returns an Observable that extracts a Long from each of the items emitted by the source Observable via a function you specify, and then emits the sum of these Longs.
static rx.Observable<java.lang.Long> sumLong(rx.Observable<java.lang.Long> source)
          Returns an Observable that emits the sum of all the Longs emitted by the source Observable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

from

public static <T> MathObservable<T> from(rx.Observable<T> o)

averageDouble

public static final rx.Observable<java.lang.Double> averageDouble(rx.Observable<java.lang.Double> source)
Returns an Observable that emits the average of the Doubles emitted by the source Observable.

Parameters:
source - source Observable to compute the average of
Returns:
an Observable that emits a single item: the average of all the Doubles emitted by the source Observable
See Also:
RxJava Wiki: averageDouble(), MSDN: Observable.Average

averageFloat

public static final rx.Observable<java.lang.Float> averageFloat(rx.Observable<java.lang.Float> source)
Returns an Observable that emits the average of the Floats emitted by the source Observable.

Parameters:
source - source Observable to compute the average of
Returns:
an Observable that emits a single item: the average of all the Floats emitted by the source Observable
See Also:
RxJava Wiki: averageFloat(), MSDN: Observable.Average

averageInteger

public static final rx.Observable<java.lang.Integer> averageInteger(rx.Observable<java.lang.Integer> source)
Returns an Observable that emits the average of the Integers emitted by the source Observable.

Parameters:
source - source Observable to compute the average of
Returns:
an Observable that emits a single item: the average of all the Integers emitted by the source Observable
Throws:
java.lang.IllegalArgumentException - if the source Observable emits no items
See Also:
RxJava Wiki: averageInteger(), MSDN: Observable.Average

averageLong

public static final rx.Observable<java.lang.Long> averageLong(rx.Observable<java.lang.Long> source)
Returns an Observable that emits the average of the Longs emitted by the source Observable.

Parameters:
source - source Observable to compute the average of
Returns:
an Observable that emits a single item: the average of all the Longs emitted by the source Observable
See Also:
RxJava Wiki: averageLong(), MSDN: Observable.Average

max

public static final <T extends java.lang.Comparable<? super T>> rx.Observable<T> max(rx.Observable<T> source)
Returns an Observable that emits the single item emitted by the source Observable with the maximum numeric value. If there is more than one item with the same maximum value, it emits the last-emitted of these.

Parameters:
source - an Observable to scan for the maximum emitted item
Returns:
an Observable that emits this maximum item
Throws:
java.lang.IllegalArgumentException - if the source is empty
See Also:
RxJava Wiki: max(), MSDN: Observable.Max

min

public static final <T extends java.lang.Comparable<? super T>> rx.Observable<T> min(rx.Observable<T> source)
Returns an Observable that emits the single numerically minimum item emitted by the source Observable. If there is more than one such item, it returns the last-emitted one.

Parameters:
source - an Observable to determine the minimum item of
Returns:
an Observable that emits the minimum item emitted by the source Observable
Throws:
java.lang.IllegalArgumentException - if the source is empty
See Also:
MSDN: Observable.Min

sumDouble

public static final rx.Observable<java.lang.Double> sumDouble(rx.Observable<java.lang.Double> source)
Returns an Observable that emits the sum of all the Doubles emitted by the source Observable.

Parameters:
source - the source Observable to compute the sum of
Returns:
an Observable that emits a single item: the sum of all the Doubles emitted by the source Observable
See Also:
RxJava Wiki: sumDouble(), MSDN: Observable.Sum

sumFloat

public static final rx.Observable<java.lang.Float> sumFloat(rx.Observable<java.lang.Float> source)
Returns an Observable that emits the sum of all the Floats emitted by the source Observable.

Parameters:
source - the source Observable to compute the sum of
Returns:
an Observable that emits a single item: the sum of all the Floats emitted by the source Observable
See Also:
RxJava Wiki: sumFloat(), MSDN: Observable.Sum

sumInteger

public static final rx.Observable<java.lang.Integer> sumInteger(rx.Observable<java.lang.Integer> source)
Returns an Observable that emits the sum of all the Integers emitted by the source Observable.

Parameters:
source - source Observable to compute the sum of
Returns:
an Observable that emits a single item: the sum of all the Integers emitted by the source Observable
See Also:
RxJava Wiki: sumInteger(), MSDN: Observable.Sum

sumLong

public static final rx.Observable<java.lang.Long> sumLong(rx.Observable<java.lang.Long> source)
Returns an Observable that emits the sum of all the Longs emitted by the source Observable.

Parameters:
source - source Observable to compute the sum of
Returns:
an Observable that emits a single item: the sum of all the Longs emitted by the source Observable
See Also:
RxJava Wiki: sumLong(), MSDN: Observable.Sum

averageDouble

public final rx.Observable<java.lang.Double> averageDouble(rx.functions.Func1<? super T,java.lang.Double> valueExtractor)
Returns an Observable that transforms items emitted by the source Observable into Doubles by using a function you provide and then emits the Double average of the complete sequence of transformed values.

Parameters:
valueExtractor - the function to transform an item emitted by the source Observable into a Double
Returns:
an Observable that emits a single item: the Double average of the complete sequence of items emitted by the source Observable when transformed into Doubles by the specified function
See Also:
RxJava Wiki: averageDouble(), MSDN: Observable.Average

averageFloat

public final rx.Observable<java.lang.Float> averageFloat(rx.functions.Func1<? super T,java.lang.Float> valueExtractor)
Returns an Observable that transforms items emitted by the source Observable into Floats by using a function you provide and then emits the Float average of the complete sequence of transformed values.

Parameters:
valueExtractor - the function to transform an item emitted by the source Observable into a Float
Returns:
an Observable that emits a single item: the Float average of the complete sequence of items emitted by the source Observable when transformed into Floats by the specified function
See Also:
RxJava Wiki: averageFloat(), MSDN: Observable.Average

averageInteger

public final rx.Observable<java.lang.Integer> averageInteger(rx.functions.Func1<? super T,java.lang.Integer> valueExtractor)
Returns an Observable that transforms items emitted by the source Observable into Integers by using a function you provide and then emits the Integer average of the complete sequence of transformed values.

Parameters:
valueExtractor - the function to transform an item emitted by the source Observable into an Integer
Returns:
an Observable that emits a single item: the Integer average of the complete sequence of items emitted by the source Observable when transformed into Integers by the specified function
See Also:
RxJava Wiki: averageInteger(), MSDN: Observable.Average

averageLong

public final rx.Observable<java.lang.Long> averageLong(rx.functions.Func1<? super T,java.lang.Long> valueExtractor)
Returns an Observable that transforms items emitted by the source Observable into Longs by using a function you provide and then emits the Long average of the complete sequence of transformed values.

Parameters:
valueExtractor - the function to transform an item emitted by the source Observable into a Long
Returns:
an Observable that emits a single item: the Long average of the complete sequence of items emitted by the source Observable when transformed into Longs by the specified function
See Also:
RxJava Wiki: averageLong(), MSDN: Observable.Average

max

public final rx.Observable<T> max(java.util.Comparator<? super T> comparator)
Returns an Observable that emits the maximum item emitted by the source Observable, according to the specified comparator. If there is more than one item with the same maximum value, it emits the last-emitted of these.

Parameters:
comparator - the comparer used to compare items
Returns:
an Observable that emits the maximum item emitted by the source Observable, according to the specified comparator
Throws:
java.lang.IllegalArgumentException - if the source is empty
See Also:
RxJava Wiki: max(), MSDN: Observable.Max

min

public final rx.Observable<T> min(java.util.Comparator<? super T> comparator)
Returns an Observable that emits the minimum item emitted by the source Observable, according to a specified comparator. If there is more than one such item, it returns the last-emitted one.

Parameters:
comparator - the comparer used to compare elements
Returns:
an Observable that emits the minimum item emitted by the source Observable according to the specified comparator
Throws:
java.lang.IllegalArgumentException - if the source is empty
See Also:
RxJava Wiki: min(), MSDN: Observable.Min

sumDouble

public final rx.Observable<java.lang.Double> sumDouble(rx.functions.Func1<? super T,java.lang.Double> valueExtractor)
Returns an Observable that extracts a Double from each of the items emitted by the source Observable via a function you specify, and then emits the sum of these Doubles.

Parameters:
valueExtractor - the function to extract a Double from each item emitted by the source Observable
Returns:
an Observable that emits the Double sum of the Double values corresponding to the items emitted by the source Observable as transformed by the provided function
See Also:
RxJava Wiki: sumDouble(), MSDN: Observable.Sum

sumFloat

public final rx.Observable<java.lang.Float> sumFloat(rx.functions.Func1<? super T,java.lang.Float> valueExtractor)
Returns an Observable that extracts a Float from each of the items emitted by the source Observable via a function you specify, and then emits the sum of these Floats.

Parameters:
valueExtractor - the function to extract a Float from each item emitted by the source Observable
Returns:
an Observable that emits the Float sum of the Float values corresponding to the items emitted by the source Observable as transformed by the provided function
See Also:
RxJava Wiki: sumFloat(), MSDN: Observable.Sum

sumInteger

public final rx.Observable<java.lang.Integer> sumInteger(rx.functions.Func1<? super T,java.lang.Integer> valueExtractor)
Returns an Observable that extracts an Integer from each of the items emitted by the source Observable via a function you specify, and then emits the sum of these Integers.

Parameters:
valueExtractor - the function to extract an Integer from each item emitted by the source Observable
Returns:
an Observable that emits the Integer sum of the Integer values corresponding to the items emitted by the source Observable as transformed by the provided function
See Also:
RxJava Wiki: sumInteger(), MSDN: Observable.Sum

sumLong

public final rx.Observable<java.lang.Long> sumLong(rx.functions.Func1<? super T,java.lang.Long> valueExtractor)
Returns an Observable that extracts a Long from each of the items emitted by the source Observable via a function you specify, and then emits the sum of these Longs.

Parameters:
valueExtractor - the function to extract a Long from each item emitted by the source Observable
Returns:
an Observable that emits the Long sum of the Long values corresponding to the items emitted by the source Observable as transformed by the provided function
See Also:
RxJava Wiki: sumLong(), MSDN: Observable.Sum