RFR: 8325679: Optimize ArrayList subList sort

Pavel Rappo prappo at openjdk.org
Wed Feb 14 23:11:04 UTC 2024


On Wed, 14 Feb 2024 21:22:14 GMT, Stuart Marks <smarks at openjdk.org> wrote:

> CopyOnWriteArrayList needs to override subList.sort since it potentially modifies the array, and COWAL needs to make a copy before making any modifications.

I admit, I didn't look into that much; I just skimmed through some overrides of `List.sort`. That said, does it mean that before `List.sort`, `Collections.sort`, which had the same implementation that the default `List.sort` now has, would not be able to be properly sort `CopyOnWriteArrayList`?

(Sorry, if I digress.)

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

PR Comment: https://git.openjdk.org/jdk/pull/17818#issuecomment-1944950931


More information about the core-libs-dev mailing list