Reputation: 330
I'm trying to combine a few Stream[String] into one, to be processed by functions downstream, not caring about orders. What's the proper way of doing this in Scala? Collect? foldLeft?
files.map(getContentAsStream).collect(?)
Thanks!
Upvotes: 0
Views: 43
Reputation: 53809
Use reduce
and the ++
function which concatenates both streams:
files.map(getContentAsStream).reduce(_ ++ _)
Upvotes: 4