Take first

library operator
ID: 21b88d35-8d82-4a38-b275-23527dffaf70
Emits first item of a stream of generic items.

Behavior

Test data showing the behavior of Take first

Strings

It emits the first item of a stream of strings.

Input Output
["f","a","c"] "f"
["a"] "a"
Empty

It emits null for empty streams.

Input Output
[] null
Complex items

It emits the first item of a stream of complex items.

Input Output
[{"a":1,"b":"a"},{"a":2... {"a":1,"b":"a"}

Implementation

The implementation of Take first makes use of the following 5 operators.

3
Emits a constant value for each item.
1
Emits a constant value for each item.
1
Uses an iterator delegate to aggregate items of a stream.