Source.lazySingle

Defers creation of a single element source until there is demand.

Source operators

Signature

Source.lazySingleSource.lazySingle

Description

Invokes the user supplied factory when the first downstream demand arrives, then emits the returned single value downstream and completes the stream.

Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts the laziness and will trigger the factory immediately.

Reactive Streams semantics

emits when there is downstream demand and the element factory has completed

completes after emitting the single element

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.