RFR: 8272137: Make Collection and Optional classes streamable

Brian Goetz briangoetz at openjdk.java.net
Sun Aug 15 01:10:25 UTC 2021


On Mon, 9 Aug 2021 12:28:23 GMT, CC007 <github.com+5381337+CC007 at openjdk.org> wrote:

> create Streamable and ParallelStreamable interface and use them in Collection and Optional

I understand what you are proposing. I do not believe Streamable carries its weight.  



Sent from my iPad

> On Aug 14, 2021, at 8:53 PM, CC007 ***@***.***> wrote:
> 
> 
> I object to this change. These issues were explored in the JSR 335 EG and it was agreed that this abstraction did not carry its weight. In any case, it is premature to bring a PR for a significant API change that has not been discussed first on corelibs-dev. Please withdraw the PR, and if you want to continue the discussion, bring it to corelibs-dev.
> 
> I agree with the spliterator performance issues and the ability to be able to create IntStreams from Iterable. Therefore option 1 and 2 from JDK-8272137 seem fairly unfeasible to implement. This was already hinted at there, but for different reasons.
> 
> This PR however implements option 4: an option that doesn't actually make the Iterable class have a stream method, but instead abstracts the stream method to an interface. This method is then implemented by Collection and Optional. It also allows other code to implement this interface.
> 
> Using this implementation, you don't have the issues that the JSR 335 EG specified that would be present if Iterable itself were to be made Streamable. You wouldn't want that anyway, because streamability and iterability are two similar but very separate concerns in Java.
> 
>> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub, or unsubscribe.
> Triage notifications on the go with GitHub Mobile for iOS or Android.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5050


More information about the core-libs-dev mailing list