On Wed, 3 Apr 2024 15:09:15 GMT, Roger Riggs <rri...@openjdk.org> wrote:
>> This PR proposes to make empty immutable lists always throw UOE on >> `removeFirst` and `removeLast`. > > test/jdk/java/util/Collection/MOAT.java line 573: > >> 571: c::removeLast); >> 572: } >> 573: > > Would this test better if inserted in `testImmutableCollection(final > Collection<T> c, T t)`, Line 477'ish. > Or in `testImmutableList(final List<Integer> c)`, line 519. Unfortunately, the `remove(F|L)` methods are not available for general collections. `testImmutableList()` is also applied for unmodifiable lists (like `Collections.emptyList()` and `Collections.nCopies(0, ...)`) that seem to behave differently (they throw NSEE). The latter have different specifications compared to an immutable list. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18581#discussion_r1551086873