Integrated: 2311: Use getLast and removeLast methods for lists
Pavel Rappo
prappo at openjdk.org
Mon Jul 1 09:36:00 UTC 2024
On Fri, 28 Jun 2024 17:28:13 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
> Please review this simple refactoring to change most if not all occurrences of `list.get(x.size() - 1)` to `list.getLast()`.
>
> `getLast` was introduced in JDK 21, as part of JEP 431: Sequenced Collections, which also introduced a counterpart method, `getFirst()`. While there are also a lot of occurrences of `list.get(0)` in Skara codebase, changing them to `list.getFirst()` might be of insufficient benefit and, hence, is not proposed in this PR. I don't think that coinciding `get(0)` and `getLast()` would look inconsistent.
>
> The copyright years will be updated after this PR has been reviewed.
This pull request has now been integrated.
Changeset: a510583d
Author: Pavel Rappo <prappo at openjdk.org>
Committer: Erik Joelsson <erikj at openjdk.org>
URL: https://git.openjdk.org/skara/commit/a510583db9715e8091891b6cd0bbfa13380cf17a
Stats: 68 lines in 22 files changed: 0 ins; 0 del; 68 mod
2311: Use getLast and removeLast methods for lists
Reviewed-by: zsong, erikj
-------------
PR: https://git.openjdk.org/skara/pull/1665
More information about the skara-dev
mailing list