On Tue, 11 Nov 2025 18:15:04 GMT, Archie Cobbs <[email protected]> wrote:

>> Patrick Strawderman has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Fix bad merge
>
> src/java.base/share/classes/java/util/stream/StreamOpFlag.java line 753:
> 
>> 751:         int characteristics = spliterator.characteristics();
>> 752:         if ((characteristics & Spliterator.SORTED) != 0 &&
>> 753:                 (spliterator.getComparator() instanceof Comparator c &&
> 
> Not sure if the performance of `instanceof` is meaningfully faster than `!=`, 
> but the `instanceof` test could be replaced with a null test:
> 
> if ((characteristics & Spliterator.SORTED) != 0) {
>     Comparator<?> c = spliterator.getComparator();
>     if (c != null && !c.equals(Comparator.naturalOrder()) { ...

I actually prefer this, seems a bit more readable to me. Thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28226#discussion_r2515785006

Reply via email to