I am looking at the new functionality in Java7. I want to get a Collection objects returned given a specific input directory.
Currently I am using using (org.apache.commons.io)
Collection<File> files = FileUtils.listFiles(myInputFile, ...);
Instead I would like to do something like:
Collection<Path> paths = listPathsUsingJava7(myInputPath, ...);
However, I don’t see anything specific about doing it in the examples/docs out there. I see DirectoryStreams, which don’t seem to do recursion. I also see Vistors which make you take action on the current object instead of adding it to a Collection.
Does anyone have a Java7 example of doing this the correct way?
Thanks!
next JDK7 code will add all files in folder and subfolders to
files.