RFR 8144675: Add a filtering collector

Stuart Marks stuart.marks at oracle.com
Thu Dec 10 02:54:36 UTC 2015


Hi Shinya,

Thanks for doing this work. This looks very nice! (And thanks to Paul for 
helping move it through the process.)

I have only a minor comment, which is that it might be good to clarify in the 
example why a filtering collector is necessary instead of just adding a filter() 
step into the stream. (This is what prompted Henry Jen's question, and it was my 
initial thought too.)

Maybe it would be sufficient to add something like the following after the example:

« A filtering collector differs from a stream's {@code filter()} operation. In 
this example, suppose there are no employees whose salary is above the threshold 
in some department. Using a filtering collector as shown above would result in a 
mapping from that department to an empty {@code Set}. If a stream {@code 
filter()} operation were done instead, there would be no mapping for that 
department at all. »

s'marks



On 12/8/15 4:21 AM, ShinyaYoshida wrote:
> Hi Stefan,
> Thank you for pointing out.
> I've just updated:
> http://cr.openjdk.java.net/~shinyafox/8144675/webrev.03/
>
> Regards,
> shinyafox(Shinya Yoshida)
>
> 2015-12-08 21:08 GMT+09:00 Stefan Zobel <spliterator at gmail.com>:
>
>> Hi shinyafox,
>>
>> minor typo in the code example:
>>
>>
>> s/wellPaidEmployeesByDeparetment/wellPaidEmployeesByDepartment
>>
>>
>> Regards,
>> Stefan
>>
>>
>> 2015-12-08 13:04 GMT+01:00 ShinyaYoshida <bitterfoxc at gmail.com>:
>>> Thank you so much!
>>> I've updated in webrev.02.
>>>
>>> Best regard,
>>> shinyafox(Shinya Yoshida)
>>>
>>



More information about the core-libs-dev mailing list