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:
Step by Step Answer:
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp