RFR: 2311: Use getLast and removeLast methods for lists [v2]
Pavel Rappo
prappo at openjdk.org
Fri Jun 28 22:48:07 UTC 2024
> 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.
Pavel Rappo has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
- Merge branch 'openjdk:master' into 2311
- Initial commit
-------------
Changes:
- all: https://git.openjdk.org/skara/pull/1665/files
- new: https://git.openjdk.org/skara/pull/1665/files/ceace51a..9680af96
Webrevs:
- full: https://webrevs.openjdk.org/?repo=skara&pr=1665&range=01
- incr: https://webrevs.openjdk.org/?repo=skara&pr=1665&range=00-01
Stats: 163 lines in 48 files changed: 35 ins; 27 del; 101 mod
Patch: https://git.openjdk.org/skara/pull/1665.diff
Fetch: git fetch https://git.openjdk.org/skara.git pull/1665/head:pull/1665
PR: https://git.openjdk.org/skara/pull/1665
More information about the skara-dev
mailing list