RFR: 8266571: Sequenced Collections [v8]
Stuart Marks
smarks at openjdk.org
Thu Apr 20 04:43:05 UTC 2023
On Fri, 24 Mar 2023 22:13:29 GMT, Tagir F. Valeev <tvaleev at openjdk.org> wrote:
>> Stuart Marks has updated the pull request incrementally with four additional commits since the last revision:
>>
>> - Add missing @throws and @since tags.
>> - Convert code samples to snippets.
>> - Various editorial changes.
>> - Fix up toArray(T[]) on reverse-ordered views.
>
> src/java.base/share/classes/java/util/ReverseOrderSortedMapView.java line 99:
>
>> 97:
>> 98: public Set<K> keySet() {
>> 99: return new AbstractSet<>() {
>
> At very least, please delegate `contains`, `remove`, and `clear`, to avoid O(N) complexity there. Same for `values()` and `entrySet()`
OK. I've delegated all of these through the base map's views instead of taking shortcuts (e.g., the keyset's clear() is `base.keySet().clear()` instead of `base.clear()`) in order to preserve any special semantics the underlying map might have for these methods on its views.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r1172072870
More information about the core-libs-dev
mailing list