On Thu, 7 May 2026 22:10:23 GMT, Remi Forax <[email protected]> wrote:
> For implementors of java.util.List, it is not clear how to guarantee that > remove(index) and removeAtIndex() are always in sync, especially because most > of the named implementation of java.util.List can be inherited. We do not > want to be in a situation where remove(index) and removeAtIndex() have two > different implementations. I don't think it's possible or necessary to try to establish any such guarantee. There are many constraints that List subclasses must uphold that the language and API cannot guarantee. We could provide some documentation for subclassers so that they don't make mistakes, e.g., > API Note: > > The `removeAtIndex` method is a synonym for `remove(int)`. They have exactly > the same semantics. > Given that the default implementation of `removeAtIndex` simply calls > `remove(int)`, it is usually unnecessary > for subclasses to override the `removeAtIndex` method. ------------- PR Comment: https://git.openjdk.org/jdk/pull/31064#issuecomment-4423277699
