This is a follow-up to my previous question.
Suppose I process my files in parallel. Now I would like to write the processing results to a file. Since the results do not fit in memory I cannot just wait until the processing of all files finish and then write the results. I have to do the processing and writing in parallel somehow.
For example: Suppose I have files with numbers. The file size is about 500M
. The number of files is about 200
. Each file fits in memory but all of them do not fit. Now I would like to write all even numbers found in these files to another file.
How to do that in Scala (with Futures
, and Scala parallel collections
)?