Notes

1A lambda expression is not an anonymous class; it actually uses invokedynamic in the byte-code.

2We will explain what “functional interface” means in a later section.

3Of course you should add a catch statement to this for error handling.

4The actual method signature is walk(Path start, FileVisitOption... options) but you will probably just use walk(Path).