Chapter 9 I/O and NIO page 515
At the bottom of the page, in the source code sample, inside the overriding visitFile method:
Says:
if (file.getFileName().endsWith(".class"))
Files.delete(file);
It is intended to filter all .class files and remove them, isn't it?
endsWith(String other) method from Path interface API says:
"On UNIX for example, the path "foo/bar" ends with "foo/bar" and "bar". It does not end with "r" or "/bar". Note that trailing separators are not taken into account, and so invoking this method on the Path"foo/bar" with the String "bar/" returns true."
Should be:
if (file.getFileName().toString().endsWith(".class"))
Files.delete(file);