BiCollector

Paul Sandoz paul.sandoz at oracle.com
Tue Jun 19 16:42:01 UTC 2018


Gosh, this is a tricky one to name.

collectingTo seems the best so far, although collect(collectingTo(…)) ...

One last suggestion from me, “expanding”, as in the collector expands the number of collectors the input elements are applied to.

Paul.



> On Jun 19, 2018, at 7:47 AM, Brian Goetz <brian.goetz at Oracle.COM> wrote:
> 
> It is "distributing" in the same sense as the distributive law:
> 
>     c*(a+b) = c*a + c*b
> 
> (Think of the two collectors as the "sum" of a collector, and "distributing" says that you can send the elements to the sum by sending all of the elements to each.)
> 
> That said, I agree that the less mathematically-inclined might be drawn to the plain-english meaning, which is more like an (imprecise) bisection.
> 
> On 6/19/2018 10:14 AM, Zheka Kozlov wrote:
>> I don't like `distributing` for the same reason as `bisecting`: for me, it sounds like a Stream is giving each collector only a part of elements.
>> 
>> 2018-06-19 19:44 GMT+07:00 Brian Goetz <brian.goetz at oracle.com <mailto:brian.goetz at oracle.com>>:
>> 
>> 
>> 
>>        collectingToBoth
>> 
>> 
>>    This one is actually both evocative of what the method does, and
>>    in the spirit of the existing naming conventions (collectingAndThen.)
>> 
>>    An n-ary version could just be called `collectingTo`, where it is
>>    passed a varargs of Collector.  Could we get away with
>>    collectingTo for a binary version as well?  The existence of the
>>    "combiner" function might make that a stretch, but I prefer
>>    `collectingTo` to `collectingToBoth`.
>> 
>> 
>>    (I still like `distributing` too.)
>> 
>> 
> 



More information about the core-libs-dev mailing list