Is it somehow possible, using Scala's parallel collections to parallelize an Iterator
without evaluating it completely beforehand?
Here I am talking about parallelizing the functional transformations on an Iterator
, namely map
and flatMap
.
I think this requires evaluating some elements of the Iterator
in advance, and then computing more, once some are consumed via next
.
All I could find would require the iterator to be converted to a Iterable
or a Stream
at best. The Stream
then gets completely evaluated when I call .par
on it.
I also welcome implementation proposals if this is not readily available. Implementations should support parallel map
and flatMap
.