collect

Apply a partial function to each incoming element, if the partial function is defined for a value the returned value is passed downstream.

Simple operators

Signature

def collect[T](pf: PartialFunction[Out, T]): Repr[T]

Description

Apply a partial function to each incoming element, if the partial function is defined for a value the returned value is passed downstream. Can often replace filter followed by map to achieve the same in one single stage.

emits when the provided partial function is defined for the element

backpressures the partial function is defined for the element and downstream backpressures

completes when upstream completes

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.