NIO.2 - Presenting the New Stream Methods

3 important questions on NIO.2 - Presenting the New Stream Methods

Why will the Files.walk() method not traverse symbolic links by default?

To avoid circular paths

Which two generic objects are taken by the BiPredicate in Files.find(Path, int, BiPredicate) method?

  • Path, and
  • BasicFileAttributes

What is the difference between Files.readAllLines() and Files.lines()?


Files.readAllLines() reads the entire file into memory and stores all lines in a List<String>
Files.lines() reads the lines lazily and presents them as a Stream<String>

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo