Write a file searching program that uses streams to efficiently search a set of files for a

Question:

Write a file searching program that uses streams to efficiently search a set of files for a given substring. Write two versions of the code, one that sequentially reads each file with a Scanner and checks each line to see if it contains the substring, and a second that uses streams to open all of the files and search the lines using stream operations. The most efficient version of the stream code will open all of the files in parallel. Test how much more efficient the streams are than the Scanner by using System.currentTimeMillis to measure the elapsed time for both versions of the code when run on a collection of large files, printing output such as the following:

Searching 15 files for

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question
Question Posted: