The aggregate operators and the BlockingObservable class

Aggregate operators produce the Observable instances, which emit only one item and complete. This item is composed or is computed using all the items emitted by the source Observable instance. In this section, we'll talk about only two of them. For more detailed information, refer to https://github.com/ReactiveX/RxJava/wiki/Mathematical-and-Aggregate-Operators.

The first of these operators is the count() or countLong() method. It emits the number of the items emitted by the source Observable instance. For example:

Observable
  .range(10, 100)
  .count()
  .subscribe(System.out::println);

This will print 100.

The other one is the toList() or toSortedList() method, which emits a list variable (that ...

Get Learning Reactive Programming with Java 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.