Count items

library operator
ID: 5df619e7-f8ab-44d9-b315-05fdcd52ee43
Counts number of items in a stream of generic items.


Test data showing the behavior of Count items

Count items

It counts the number of items in a stream.

Input Output
[1,"b",false,null] 4
[1,2,3,4,5] 5
["a","b","abc"] 3
Zero if empty

It emits 0 for empty streams.

Input Output
[] 0


The implementation of Count items makes use of the following 3 operators.

Adds two numbers A and B and emits their sum.
Emits a constant value for each item.
Reduces the items of a stream pairwise using a reducer delegate.

Used in

The Count items operator is used by 2 operators.

Emits the median number of a stream of numbers.
Emits the average of a stream of numbers.