On Files? Yes, that does indeed look suspiciously like it'll cover the current use cases I have. Let me check & come back if not.
Ben On Tue, Aug 6, 2013 at 3:15 PM, Alan Bateman <[email protected]>wrote: > On 06/08/2013 06:39, Ben Evans wrote: > >> Hi, >> >> I have a suggestion for a point lambdafication change which I don't think >> anyone's proposed yet. (As usual, if my Google-fu has failed me, please >> point me at the relevant discussion). >> >> In java.nio.file we have the FileVisitor interface, which defines 4 >> methods. >> >> We also have the SimpleFileVisitor class which defines sane (basically >> no-op) implementations of all the methods. >> >> In using FileVisitor, I've noticed that visitFile() tends to be overridden >> / used far more often than the others. It would be nifty if it we could >> lambdify in such a way that a lambda expression could be fed to >> Files.walkFileTree(). >> >> Could we add default implementations to FileVisitor (those from >> SimpleFileVisitor seem reasonable) for all methods except visitFile() ? >> >> This would then make code like this possible: >> >> Path homeDir = Paths.get("/Users/kittylyst"); >> Files.walkFileTree(homeDir, (p, attrs) -> { >> System.out.println(p.**getFileName()); return FileVisitResult.CONTINUE; >> }); >> >> I have a patch which demonstrates this - let me know if there's potential >> here, and if anyone would be interested in sponsoring the patch. >> >> Have you looked at the walk and find methods? (They currently return a > CloseableStream but there is discussion on just returning a Stream). > > -Alan. >
