fromIterator

Stream the values from an Iterator, requesting the next value when there is demand.

Source operators

Signature

def fromIterator[T](f: () ⇒ Iterator[T]): Source[T, NotUsed]

Description

Stream the values from an Iterator, requesting the next value when there is demand. The iterator will be created anew for each materialization, which is the reason the method factory takes a function Creator rather than an Iterator directly.

If the iterator perform blocking operations, make sure to run it on a separate dispatcher.

emits the next value returned from the iterator

completes when the iterator reaches its end

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.