What is the best practice for flatMap replacment (original) (raw)
Paul Sandoz paul.sandoz at oracle.com
Thu Apr 11 05:11:01 PDT 2013
- Previous message: What is the best practice for flatMap replacment
- Next message: RFR JDK-8011426: java.util collection Spliterator implementations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Apr 9, 2013, at 11:59 PM, Brian Goetz <brian.goetz at Oracle.COM> wrote:
In a few days, you'll have:
Streams.singleton(e) and new StreamBuilder() to help you along.
Here you go:
http://hg.openjdk.java.net/lambda/lambda/jdk/rev/105d2c765fae
Paul.
On 4/9/2013 5:31 PM, Boaz Nahum wrote:
My old code:
public void flattenInto(T element, Consumer sink) { R r = .. if (...) { sink.accept(r); } Is replaced with: Stream<? extends R> apply(T element) { R r = ... return ? (...) : Collections.singleton(t).stream() : null; } I wonder if I can do better. Thanks Boaz
- Previous message: What is the best practice for flatMap replacment
- Next message: RFR JDK-8011426: java.util collection Spliterator implementations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]