I\'m currently trying to read lines from a text only file that I have. I found on another stackoverflow(Reading a plain text file in Java) that you can use Files.lines(..).f
I have created a sample , you can use the Stream to filter/
public class ReadFileLines {
public static void main(String[] args) throws IOException {
Stream lines = Files.lines(Paths.get("C:/SelfStudy/Input.txt"));
// System.out.println(lines.filter(str -> str.contains("SELECT")).count());
//Stream gets closed once you have run the count method.
System.out.println(lines.parallel().filter(str -> str.contains("Delete")).count());
}
}
Sample input.txt.
SELECT Every thing
Delete Every thing
Delete Every thing
Delete Every thing
Delete Every thing
Delete Every thing
Delete Every thing