"Walk the Line" in JAVA

by zemion
Posted in Java

When traversing the file tree, JAVA provides a FileVisitor as part of the features intoduced with NIO2. With this interface, a file tree can be traversed to any depth, performing actions on the files and/or directories found on any branch. A nice feature and a lot faster than previous (recursive) solutions. Thanks, NIO2!

The official tutorial by Oracle mentions two methods to traverse the file tree:

Read further