Replace Arrays.asList() and addAll() with Collections.addAll()#5561
Merged
sbrannen merged 2 commits intojunit-team:mainfrom Mar 27, 2026
Merged
Conversation
ad497ee to
6a07f3e
Compare
This comment has been minimized.
This comment has been minimized.
Simplify several internal collection update sites by replacing Arrays.asList(...) used only as an intermediate step before addAll(...) with Collections.addAll(...). This makes the code more direct and easier to read, avoids creating intermediate list views solely for collection updates, and removes some now-unnecessary imports and casts. Where needed, existing validation is kept explicit before adding the elements. No functional change intended. Signed-off-by: Kawshik Kumar Paul <kawshikbuet17@gmail.com>
6a07f3e to
a587ec2
Compare
This comment has been minimized.
This comment has been minimized.
sbrannen
approved these changes
Mar 27, 2026
Arrays.asList() and addAll() with Collections.addAll()
🔎 No tests executed 🔎🏷️ Commit: 45ff8dc Learn more about TestLens at testlens.app. |
Member
|
This has been merged into Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR simplifies a few internal collection update sites by replacing
Arrays.asList(...) used only as an intermediate step before addAll(...)
with Collections.addAll(...).
That makes the affected code paths more direct and easier to follow,
since the intent is simply to add array or varargs elements into an
existing collection. It also avoids creating intermediate list views for
those updates.
In ListenerRegistry, null-element validation is kept explicit before
adding the listeners, so the refactoring preserves the expected checks
while removing the extra conversion step.
No functional change intended.