Skip to content

Instantly share code, notes, and snippets.

@SoltauFintel
Created April 1, 2017 13:43
Show Gist options
  • Save SoltauFintel/2ab1a0efb7e158d30118b235e425df64 to your computer and use it in GitHub Desktop.
Save SoltauFintel/2ab1a0efb7e158d30118b235e425df64 to your computer and use it in GitHub Desktop.
List recursive files with Java 8
Files.walkFileTree(Paths.get("../hello-web"), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (file.toString().endsWith(".java")) {
System.out.println(file);
}
return super.visitFile(file, attrs);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment