RFR: 8266571: Sequenced Collections [v4]

Stuart Marks smarks at openjdk.org
Tue Apr 25 00:49:30 UTC 2023


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

>> @liach 
>> 
>> I understand that you're suggesting adding various default implementations in order to make it easier for people to bring up implementations of SequencedCollections. However, adding default implementations to SequencedCollection itself is unlikely to help. I expect that most implementations will override both addFirst and addLast. Requiring overriding of only one of them will hardly help anything, because the more difficult task is implementing the reverse-ordered view. I'd prefer to concentrate on some kind of implementation assistance for doing that. For example, there could be an "AbstractSequencedCollection" that would require overriding only a couple methods, rather like `AbstractCollection`. I'm a bit reluctant to introduce new abstract classes into the public API though. An alternative might be to have some kind of static factory method that takes something like a Collection and a reverse iterator and returns a SequencedCollection.
>> 
>> It's not clear to me that such support is necessary. It's pretty easy to bring up a List using AbstractList, and a List is a SequencedCollection. But if we do add something, it should be driven by use cases, and not speculation.
>
> @stuart-marks 
> 
>> Thanks for looking! I took a quick look through the comments and they seem reasonable. Right now I'm concentrating on the specification in order to get the CSR Finalized. Do you have any comments on the specifications? I'll take a look at the implementation comments afterward. Some I'll be able to address before integration, but some I might need to postpone until later.
> 
> The specification is mostly well-written, thanks! I've added a few comments on the spec and few more comments on the implementation. Please check.

@amaembo Thanks for your excellent comments. I've believe I've either responded to or addressed all of the issues you've raised, with the exception of the issues regarding spliterators. The current spliterators are in a fairly poor state, but I'd prefer to postpone that work until after this main PR has been integrated. I've filed a bug to track this work: [JDK-8306785](https://bugs.openjdk.org/browse/JDK-8306785).

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

PR Comment: https://git.openjdk.org/jdk/pull/7387#issuecomment-1521008864


More information about the core-libs-dev mailing list