RFR: 8266571: Sequenced Collections [v4]

Stuart Marks smarks at openjdk.org
Wed Apr 19 02:58:16 UTC 2023


On Thu, 30 Mar 2023 09:23:04 GMT, Tagir F. Valeev <tvaleev at openjdk.org> wrote:

>> Stuart Marks has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Simplify handling of cached keySet, values, and entrySet views.
>
> src/java.base/share/classes/java/util/SequencedCollection.java line 45:
> 
>> 43:  * required to operate on elements in encounter order include the following:
>> 44:  * {@link Iterable#forEach forEach}, {@link Collection#parallelStream parallelStream},
>> 45:  * {@link Collection#spliterator spliterator}, {@link Collection#stream stream},
> 
> Should we require in specification that the implementations of `SequencedCollection::spliterator` must have the `ORDERED` charactersitic?

In principle yes, and for some spliterators the characteristics are specified. But there are a bunch of issues in JDK regarding spliterators that seem like they ought to have certain characteristics present but in fact do not. And also, most of the spliterator characteristics aren't used. They're mostly optimization hints anyway. I'm reluctant to add requirements for characteristics that might generate a bunch of testable assertions that will need to be met, generating a lot of work for not much gain. But overall spliterator characteristics should be revisited across the JDK.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r1170756176


More information about the core-libs-dev mailing list