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
Files.lines(Path) expects a Path
argument and returns a Stream
. Stream#forEach(Consumer) expects a Consumer
argument. So invoke the method, passing it a Consumer. That object will have to be implemented to do what you want for each line.
This is Java 8, so you can use lambda expressions or method references to provide a Consumer
argument.