Early review on NIO Stream APIs

Henry Jen henry.jen at oracle.com
Fri Feb 8 04:45:52 UTC 2013


BiPredicate is a intentional choice, as during the walk process, the attribute is read and many times, filtering is based on file attributes.

PathMatcher is basically a Predicate<Path>, developer can easily use that in a filter with walk, which return a Stream<Path>.

Hope that helps.

Cheers,
Henry

On Feb 7, 2013, at 6:53 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:

> The find() method uses a
> 
>    BiPredicate<Path, BasicFileAttributes> matcher
> 
> what about using the existing java.nio.file.PathMatcher interface?
> There are already some implementations of PathMatcher both in JDK and
> in the wild.
> 
> PathMatcher doesn't accept the file attributes though, but that's a
> problem for most  Path-based APIs - path alone often isn't enough and
> app has to look up attributes in a separate step.
> 
> Zhong Yu
> 
> On Thu, Feb 7, 2013 at 6:15 PM, Henry Jen <henry.jen at oracle.com> wrote:
>> Hi,
>> 
>> While lambda still finalizing the final API for Stream, there are a
>> couple of streamifaction APIs in nio area, which I would like to start
>> circling around to get early feedbacks.
>> 
>> Those APIs return a CloseableStream, other than that, there is not much
>> directly connection to Stream definition.
>> 
>> The specdiff and webrev is available at
>> 
>> http://cr.openjdk.java.net/~henryjen/ccc/8006884.0/
>> 
>> Please include me in the reply as I don't necessary receiving emails
>> from all aliases.
>> 
>> Cheers,
>> Henry




More information about the core-libs-dev mailing list