Point lambdafications in java.io

Brian Goetz brian.goetz at oracle.com
Tue Jun 18 09:05:27 PDT 2013


The libraries team added the following methods to java.io and java.nio, 
with discussion on corelibs-dev:

In java.io.BufferedReader:
   Stream<String> lines()

In java.nio.Files, static methods for:

   CloseableStream<Path> list(Path dir) throws IOException;

   CloseableStream<Path> walk(Path start, int maxDepth, 
FileVisitOption... options) throws IOException

   CloseableStream<Path> walk(Path start, FileVisitOption... options) 
throws IOException

   CloseableStream<Path> find(Path start,
                            int maxDepth,
                            BiPredicate<Path, BasicFileAttributes> matcher,
                            FileVisitOption... options)
         throws IOException

   CloseableStream<String> lines(Path path, Charset cs) throws IOException


CloseableStream simply extends Stream and AutoCloseable, making it 
suitable for use with try-with-resources:

public interface CloseableStream<T> extends Stream<T>, AutoCloseable {
     void close();
}

Should we consider moving AutoCloseable up to Stream and friends, and 
get rid of CloseableStream?



More information about the lambda-libs-spec-experts mailing list