Combine StreamSupport.stream/parallelStream?

Brian Goetz brian.goetz at oracle.com
Fri Jun 28 08:29:46 PDT 2013


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.

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-experts mailing list