On 17/08/2026 14:59, David Alayachew wrote:
:

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?

It should say "Compared" rather than "Compare" but it is otherwise correct.

It just means it may be more efficient to have the source stream be filtered rather than have a filter read the attributes for each file/element, e.g

Files.walk(dir).filter(Files::isRegularFile).*

vs.

Files.find(dir, Integer.MAX_VALUE, (_, attrs) -> attrs.isRegularFile()).*

-Alan

Reply via email to