Combine StreamSupport.stream/parallelStream?
Remi Forax
forax at univ-mlv.fr
Fri Jun 28 09:09:45 PDT 2013
On 06/28/2013 05:29 PM, Brian Goetz wrote:
> Right, but remember this is not a method for general users. This is a
> method for libraries and frameworks. The people who use this method
> will understand that parallelism is a dynamic property of a stream,
> rather than a different kind of stream. So I don't expect it to be
> confusing.
but it can be a different kind of stream in the future, no ?
BTW, did you test that the VM is able to do the escape analysis to avoid
the creation of the pipeline object ?
Rémi
>
> On 6/28/2013 11:27 AM, Remi Forax wrote:
>> On 06/28/2013 04:18 PM, Brian Goetz wrote:
>>> Then we would cross that bridge when we get there!
>>
>> I've always found that a method call with true/or false in the arguments
>> was
>> not something very readable.
>>
>> Rémi
>>
>>>
>>> On 6/28/2013 6:20 AM, Remi Forax wrote:
>>>> On 06/27/2013 10:43 PM, Brian Goetz wrote:
>>>>> A possible minor API cleanup:
>>>>>
>>>>> For each pair of low-level methods stream() and parallelStream() in
>>>>> StreamSupport, we could combine these into a single method that takes
>>>>> an additional boolean isParallel argument. This matches the
>>>>> underlying implementation they call anyway, and simplifies callers
>>>>> like concat, which now does:
>>>>>
>>>>> return (a.isParallel() || b.isParallel())
>>>>> ? StreamSupport.parallelStream(split)
>>>>> : StreamSupport.stream(split);
>>>>>
>>>>> anyway.
>>>>
>>>> What if we add a third kind of stream in the future ?
>>>>
>>>> Rémi
>>>>
>>
More information about the lambda-libs-spec-observers
mailing list