This page shows operators that perform mathematical or other operations over an entire sequence of items emitted by an Observable. Because these operations must wait for the source Observable to complete emitting items before they can construct their own emissions (and must usually buffer these items), these operators are dangerous to use on Observables that may have very long or infinite sequences.

Operators in the rxjava-math module

  • averageInteger( ) — calculates the average of Integers emitted by an Observable and emits this average
  • averageLong( ) — calculates the average of Longs emitted by an Observable and emits this average
  • averageFloat( ) — calculates the average of Floats emitted by an Observable and emits this average
  • averageDouble( ) — calculates the average of Doubles emitted by an Observable and emits this average
  • max( ) — emits the maximum value emitted by a source Observable
  • maxBy( ) — emits the item emitted by the source Observable that has the maximum key value
  • min( ) — emits the minimum value emitted by a source Observable
  • minBy( ) — emits the item emitted by the source Observable that has the minimum key value
  • sumInteger( ) — adds the Integers emitted by an Observable and emits this sum
  • sumLong( ) — adds the Longs emitted by an Observable and emits this sum
  • sumFloat( ) — adds the Floats emitted by an Observable and emits this sum
  • sumDouble( ) — adds the Doubles emitted by an Observable and emits this sum

Other Aggregate Operators

  • concat( ) — concatenate two or more Observables sequentially
  • count( ) and countLong( ) — counts the number of items emitted by an Observable and emits this count
  • reduce( ) — apply a function to each emitted item, sequentially, and emit only the final accumulated value
  • collect( ) — collect items emitted by the source Observable into a single mutable data structure and return an Observable that emits this structure
  • toList( ) — collect all items from an Observable and emit them as a single List
  • toSortedList( ) — collect all items from an Observable and emit them as a single, sorted List
  • toMap( ) — convert the sequence of items emitted by an Observable into a map keyed by a specified key function
  • toMultiMap( ) — convert the sequence of items emitted by an Observable into an ArrayList that is also a map keyed by a specified key function