On Wed, 3 Jun 2026 14:25:13 GMT, Per Minborg <[email protected]> wrote:
>> src/java.base/share/classes/java/util/List.java line 1248:
>>
>>> 1246: * {@linkplain NoSuchElementException}, and the {@linkplain
>>> List#equals(Object)}
>>> 1247: * <em>may</em> throw {@linkplain NoSuchElementException}
>>> depending on which
>>> 1248: * elements (if any) are compared.
>>
>>> depending on which
>> * elements (if any) are compared.
>>
>> This reads a bit strange for me—in what way does it change depending of
>> which elements are compared?
>
> So, if `equals()` is invoked with an `obj="a"` then `obj` is not an instance
> of `List` and no elements are compared, and the method would not throw.
>
> If we have a list with `N` elements for which an element failed computation,
> and we compare against another (RandomAccess) list with `N1 != N` elements,
> then no elements are compared, and the method would not throw.
>
> If we have a List with `N` elements and the last element's computation
> failed `[N-1]` and we compare against another `List` with `N1 == N` elements
> but where any of the non-last elements differ, then the method would not
> throw.
Perhaps some variation of "if attempting to compare an element that could not
be computed"?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/31274#discussion_r3349462025