Lazy iterator over files in directory structure

253 Views Asked by At

There are related questions, but none of them addresses the "lazy" part, that is, discover more content only as the iteration progresses.

See How do I iterate through the files in a directory in Java?

Also Apache Commons FileUtils.iterateFiles() reads all files into a Collection (List) at first before getting the Iterator on that.

I have a nested directory structure with a large amount of files (2 million). My goal is to iterate the files without having to read all the names into a collection.

0

There are 0 best solutions below