Hello @core-libs-dev <[email protected]>,

I was reading the Javadoc for Files.find
<https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/nio/file/Files.html#find(java.nio.file.Path,int,java.util.function.BiPredicate,java.nio.file.FileVisitOption...)>,
and the following text confused me.

>  Compare to calling filter
<https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/util/stream/Stream.html#filter(java.util.function.Predicate)>
on the Stream returned by walk method, this method may be more efficient by
avoiding redundant retrieval of the BasicFileAttributes.

Did they mean to say compared? And if so, I am a little confused -- isn't
it Files.walk
<https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/nio/file/Files.html#walk(java.nio.file.Path,int,java.nio.file.FileVisitOption...)>
that
does not fetch BasicFileAttributes?

Or did they mean something else? Based on the fact that this method fetches
attributes while walk seemingly does not, one would think that walk is the
faster method than find, at least on paper.

Could someone help clarify this?

Thank you for your time and help.
David Alayachew

Reply via email to