[ 
https://issues.apache.org/jira/browse/HADOOP-12311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Victor Malov  updated HADOOP-12311:
-----------------------------------
    Description: 
After looking at Filesystem API, I couldn't find Stream-based API, which will 
be work well with Java lambda-functions and be able chain calls.

As Hadoop 3.0 is going to support JDK 8, I propose implement general 
stream-based Filesystem API similar to as implemented in Java SE 8:

static Stream<String>   lines(Path path, Charset cs)

This probably will looks similar to this:
try (Stream<Path> stream = Files.list(Paths.get(""))) { 
    String joined = stream
                           . map(String::valueOf)

                           .filter(path -> !path.startsWith("."))

                           .sorted()

                           .collect(Collectors.joining("; "));
    System.out.println("List: " + joined);
}

  was:
After looking at Filesystem API, I couldn't find Stream-based API, which will 
be work well with Java lambda-functions and be able chain calls.

As Hadoop 3.0 is going to support JDK 8, I propose implement general 
stream-based Filesystem API similar to as implemented in Java SE 8:

static Stream<String>   lines(Path path, Charset cs)

This probably will looks similar to this:
try (Stream<Path> stream = Files.list(Paths.get(""))) { 
    String joined = stream
                           . map(String::valueOf)
                           .filter(path -> !path.startsWith("."))
                           .sorted()
                           .collect(Collectors.joining("; "));
    System.out.println("List: " + joined);
}


> Implement stream-based Filesystem API
> -------------------------------------
>
>                 Key: HADOOP-12311
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12311
>             Project: Hadoop Common
>          Issue Type: New Feature
>          Components: fs
>            Reporter: Victor Malov 
>            Priority: Minor
>
> After looking at Filesystem API, I couldn't find Stream-based API, which will 
> be work well with Java lambda-functions and be able chain calls.
> As Hadoop 3.0 is going to support JDK 8, I propose implement general 
> stream-based Filesystem API similar to as implemented in Java SE 8:
> static Stream<String>         lines(Path path, Charset cs)
> This probably will looks similar to this:
> try (Stream<Path> stream = Files.list(Paths.get(""))) { 
>     String joined = stream
>                            . map(String::valueOf)
>                            .filter(path -> !path.startsWith("."))
>                            .sorted()
>                            .collect(Collectors.joining("; "));
>     System.out.println("List: " + joined);
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to