RFR: 8179918: EnumSet spliterator should report SORTED, ORDERED, NONNULL [v6]
Viktor Klang
vklang at openjdk.org
Thu Dec 4 17:41:48 UTC 2025
On Wed, 3 Dec 2025 18:58:26 GMT, Patrick Strawderman <duke at openjdk.org> wrote:
>> I noticed that the Spliterator for EnumSet does not report SORTED, ORDERED, or NONNULL characteristics, all of which are inherent to API of EnumSet. I found there's an existing ticket for this as well.
>>
>> The ticket also mentions optimized `forEach`, etc, which I presume means avoiding the default implementation that uses the iterator and just iterating over the bitset directly; I can add that here or perhaps in a follow up if it's still deemed worthwhile.
>
> Patrick Strawderman has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix test
test/jdk/java/util/EnumSet/EnumSetSpliteratorTest.java line 66:
> 64: assertSpliteratorCharacteristics(EnumSet.allOf(Empty.class));
> 65: assertSpliteratorCharacteristics(EnumSet.allOf(Small.class));
> 66: assertSpliteratorCharacteristics(EnumSet.allOf(Large.class));
For the sake of completeness, it probably makes sense to test the characteristics of `EnumSet.of(…)`, `EnumSet.range(…)`, and `EnumSet.noneOf(…)` as well.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28568#discussion_r2589995448
More information about the core-libs-dev
mailing list