On Fri, 26 Apr 2024 22:11:07 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Do we need additional tests or are these modifications already covered by 
>> the existing tests?
>
> @minborg I have added a test as part of Collection mother-of-all-tests to 
> ensure spliterator and forEach yields in the same order as iterator for 
> unmodifiable/immutable collections. One thing of note is that somehow `==` 
> for yields fail for some collections like 
> `unmodifiableSequencedMap(linkedHashSet).sequencedKeySet()` so I have to use 
> `Objects.equals` instead.

@liach
> One thing of note is that somehow `==` for yields fail for some collections 
> like `unmodifiableSequencedMap(linkedHashSet)​.sequencedKeySet()` so I have 
> to use `Objects.equals` instead.

Actually, it’d be for `unmodifiableMap(…)​.entrySet()` and 
`Map​.of(…)​.entrySet()`, as those create a new `UnmodifiableEntry` and 
`KeyValueHolder` on iteration respectively.

`unmodifiableSequencedMap(…)​.sequencedKeySet()` should work with `==`.

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

PR Comment: https://git.openjdk.org/jdk/pull/15834#issuecomment-2081284896

Reply via email to