FileVisitor extension method
Paulo Levi
i30817 at gmail.com
Sun Jun 10 13:20:17 PDT 2012
You're right of course, the method there would be useless in the context
of nio2, serving more as a adaptation measure to old code that already was
using files and filefilters.
about newDirectoryStream; i'm actually using 'walkFileTree' (in a rather
lame eager way, but that's another story), and although implementations can
certainly filter files themselves, i was trying to separate the iteration
strategy from the actual filtering. FileFilter was the first class i used
and noticed the obvious problem so i ended up reinventing the wheel a bit.
BTW; on a completely different matter, i was hoping that walking the tree
would be a win, (and by rule-of-thumb it seems faster), my actual task
actually requires eagerness at the end, for 2 reasons: one is performance
(ironic) since i am holding a lock of a glazedlist and want to add all as a
collection, the other (unsolvable here), is priority, where some
application logic orders the 'most interresting' first.
I suppose i could fix the first with the terrible antipattern of faking the
collection interface (since they just iterate over it to move the objects).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20120610/81db7ea3/attachment.html
More information about the nio-discuss
mailing list