RFR: 2311: Use getLast and removeLast methods for lists [v3]
Pavel Rappo
prappo at openjdk.org
Fri Jun 28 23:05:30 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 incrementally with one additional commit since the last revision:
Update copyright years
Note: any commit hashes below might be outdated due to subsequent
history rewriting (e.g. git rebase).
+ update args/src/main/java/org/openjdk/skara/args/ArgumentParser.java due to ceace51a
+ update bots/bridgekeeper/src/main/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBot.java due to ceace51a
+ update bots/bridgekeeper/src/test/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBotTests.java due to ceace51a
+ update bots/cli/src/test/java/org/openjdk/skara/bots/cli/BotSlackHandlerTests.java due to ceace51a
+ update bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/ArchiveItem.java due to ceace51a
+ update bots/notify/src/main/java/org/openjdk/skara/bots/notify/mailinglist/MailingListNotifier.java due to ceace51a
+ update bots/notify/src/test/java/org/openjdk/skara/bots/notify/issue/IssueNotifierTests.java due to ceace51a
+ update bots/notify/src/test/java/org/openjdk/skara/bots/notify/prbranch/PullRequestBranchNotifierTests.java due to ceace51a
+ update bots/pr/src/main/java/org/openjdk/skara/bots/pr/ReviewersTracker.java due to ceace51a
+ update bots/pr/src/test/java/org/openjdk/skara/bots/pr/CSRBotTests.java due to ceace51a
+ update bots/pr/src/test/java/org/openjdk/skara/bots/pr/CommitCommandAsserts.java due to ceace51a
+ update bots/pr/src/test/java/org/openjdk/skara/bots/pr/IntegrateTests.java due to ceace51a
+ update bots/pr/src/test/java/org/openjdk/skara/bots/pr/SponsorTests.java due to ceace51a
+ update forge/src/main/java/org/openjdk/skara/forge/PullRequest.java due to ceace51a
+ update test/src/main/java/org/openjdk/skara/test/HostCredentials.java due to ceace51a
+ update vcs/src/test/java/org/openjdk/skara/vcs/openjdk/converter/GitToHgConverterTests.java due to ceace51a
+ update webrev/src/main/java/org/openjdk/skara/webrev/HunkCoalescer.java due to ceace51a
-------------
Changes:
- all: https://git.openjdk.org/skara/pull/1665/files
- new: https://git.openjdk.org/skara/pull/1665/files/9680af96..6e17f33c
Webrevs:
- full: https://webrevs.openjdk.org/?repo=skara&pr=1665&range=02
- incr: https://webrevs.openjdk.org/?repo=skara&pr=1665&range=01-02
Stats: 17 lines in 17 files changed: 0 ins; 0 del; 17 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