Into

Remi Forax forax at univ-mlv.fr
Wed Dec 26 10:02:11 PST 2012


On 12/26/2012 06:07 PM, Doug Lea wrote:
> On 12/26/12 11:52, Remi Forax wrote:
>
>> No, I think it's better to have only toList() and toSet(),
>> the result of stream.sorted().toSet() will return a 
>> NavigableSet/SortedSet.
>> The idea is that the method to* will choose the best implementation 
>> using the
>> property of the pipeline.
>>
>> If you want a specific implementation, then use into().
>
> Sorry, I still don't buy it. If you want a specific implementation,
> then my sense is that you will end up writing something like
> the following anyway:
>
>   Stream s = ...;
>   SomeCollection dest = ...
>   // add s to dest via (par/seq) forEach or loop or whatever

again, letting people to do the copy will create a lot of non thread 
safe codes.
I see forEach is a necessary evil, not as something that people should 
use every days.

>
> so why bother adding all the support code that people will probably
> not use anyway in custom situations because, well, they are custom
> situations. So to me, Reducers etc are in the maybe-nice-to-have
> category.

while I agree that custom reducers have to fly by themselves,
we need to provide an operation that pull all elements from a parallel 
stream and put them in any collections in a thread safe manner that 
doesn't require 10 eyeballs to look at the code.

>
> -Doug
>
>

Rémi



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