RFR: 8272137: Make Iterable classes streamable
CC007
github.com+5381337+cc007 at openjdk.java.net
Sat Aug 14 11:28:27 UTC 2021
On Sat, 14 Aug 2021 00:53:06 GMT, liach <github.com+7806504+liach at openjdk.org> wrote:
> Aren't all iterable implementations effectively streamable if they properly implement `spliterator`? And the spliterator implementation can always be sequential or parallel, dependent on how you feed it into `StreamSupport`.
Yes indeed, but to add extra methods to the Iterable interface itself could have compatibility or possible security issues depending on whether these methods are abstract or not resp.
Therefore I made it a fully separate interface here and used it in places with known implementations (Collection and Optional) so that there's no changes in the exposed API of the other classes. The only difference is that you can now make use of the fact that these interfaces extend Streamable and/or ParallelStreamable
-------------
PR: https://git.openjdk.java.net/jdk/pull/5050
More information about the core-libs-dev
mailing list