Hello David, Redirecting to nio-dev.
On Sep 10, 2025, at 12:01 PM, David Alayachew <[email protected]> wrote: One would expect only fileZ.html to be printed out, but nothing does. The reason why is because path.endsWith(String) is effectively an alias for path.endsWith(Path.of(String)). The confusion being that Path.of(someString) is looking for a file or a directory. Thus, since there is neither a file nor a folder called "html", the stream prints out nothing. The specification looks like it is pretty clear about the behavior, especially the implementation note in Path.endsWith(String)<https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/nio/file/Path.html#endsWith(java.lang.String)>: "The default implementation is equivalent for this path to: endsWith(getFileSystem().getPath(other));" What you were expecting sounds like what would be given by .filter(path -> path.toString().endsWith("html”)) or better .filter(path -> path.getFileName().toString().endsWith("html”)) Is that correct? If we could eventually agree on how to handle file extensions, that would help here. Brian
