prefixAndTail

Take up to n elements from the stream (less than n only if the upstream completes before emitting n elements) and returns a pair containing a strict sequence of the taken element and a stream representing the remaining elements.

Nesting and flattening operators

Signature

Source.prefixAndTailSource.prefixAndTail Flow.prefixAndTailFlow.prefixAndTail

Description

Take up to n elements from the stream (less than n only if the upstream completes before emitting n elements) and returns a pair containing a strict sequence of the taken element and a stream representing the remaining elements.

Reactive Streams semantics

emits when the configured number of prefix elements are available. Emits this prefix, and the rest as a substream

backpressures when downstream backpressures or substream backpressures

completes when prefix elements has been consumed and substream has been consumed

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.