What is the best practice for flatMap replacment (original) (raw)
Boaz Nahum boaznahum at gmail.com
Tue Apr 9 14:43:48 PDT 2013
- Previous message: What is the best practice for flatMap replacment
- Next message: What is the best practice for flatMap replacment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Sorry for comment about my own question, but I really feel bad about this.
Once again I cant do better because stream package is so 'closed'
Maybe we can ask for super optimized Streams.singleton(r) ?
Boaz
On Wed, Apr 10, 2013 at 12:31 AM, Boaz Nahum <boaznahum at gmail.com> 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: What is the best practice for flatMap replacment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]