Hands-On Reactive Programming in Spring 5
上QQ阅读APP看书,第一时间看更新

Count operator

The count operator is pretty descriptive; it emits the only value with the number of elements in the input stream. However, the count emits at the moment when the original stream completes, so, in the case of an endless stream, the count will not ever finish or return anything, as shown in the following diagram:

Diagram 2.9 Count o perator: counts the number of items emitted by the Observable source   and emit only this value