One more pass on flatMap/mapMulti

Joe Bowbeer joe.bowbeer at gmail.com
Thu Jan 10 08:14:17 PST 2013


I don't mind Downstream, but something like Acceptor might be better.

However, yield should be renamed in either case.

receive?

downstreamReceive?

We are going to run out of names fast!

Why not a convention for these names to avoid this?

One way to disambiguate and relieve the name stress (and stress of naming)
is to apt adopt this convention:

downstreamApply

That is, prepend interface name to method name.  In this case all the
method names could be simply 'apply' because we already know the interrace
names are unique. I don't have a dog in that hunt.

Joe
 On Jan 10, 2013 8:01 AM, "Tim Peierls" <tim at peierls.net> wrote:

> How about Acceptor?
>
> On Thu, Jan 10, 2013 at 10:54 AM, Brian Goetz <brian.goetz at oracle.com>wrote:
>
>> Downstream:
>>
>>     /** A collector for values associated with a given input.  Values can
>> be
>>      * yielded individually, or in aggregates such as collections,
>> arrays, or
>>      * streams; aggregates are flattened, so that yielding an array
>> containing
>>      * [1, 2] is equivalent to yield(1); yield(2).
>>      */
>>     interface Downstream<U> {
>>         void yield(U element);
>>
>>         default void yield(Collection<U> collection) {
>>             for (U u : collection)
>>                 yield(u);
>>         }
>>
>>         default void yield(U[] array) {
>>             for (U u : array)
>>                 yield(u);
>>         }
>>
>>         default void yield(Stream<U> stream) {
>>             stream.forEach(this::yield);
>>         }
>>     }
>>
>> The basic idea is that this is a collector for values.  It was at one
>> point called "collector" but now we have something else called Collector.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20130110/1453dcd4/attachment-0001.html 


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