Skip to content

Replace Arrays.asList() and addAll() with Collections.addAll()#5561

Merged
sbrannen merged 2 commits intojunit-team:mainfrom
kawshikbuet17:refactor/logic-modernization-and-efficiency
Mar 27, 2026
Merged

Replace Arrays.asList() and addAll() with Collections.addAll()#5561
sbrannen merged 2 commits intojunit-team:mainfrom
kawshikbuet17:refactor/logic-modernization-and-efficiency

Conversation

@kawshikbuet17
Copy link
Copy Markdown
Contributor

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.

@kawshikbuet17 kawshikbuet17 force-pushed the refactor/logic-modernization-and-efficiency branch from ad497ee to 6a07f3e Compare March 27, 2026 07:06
@testlens-app

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>
@sbrannen sbrannen force-pushed the refactor/logic-modernization-and-efficiency branch from 6a07f3e to a587ec2 Compare March 27, 2026 10:08
@testlens-app

This comment has been minimized.

@sbrannen sbrannen changed the title Replace Arrays.asList() + addAll() with Collections.addAll() Replace Arrays.asList() and addAll() with Collections.addAll() Mar 27, 2026
@testlens-app
Copy link
Copy Markdown

testlens-app Bot commented Mar 27, 2026

🔎 No tests executed 🔎

🏷️ Commit: 45ff8dc
▶️ Tests: 0 executed
🟡 Checks: 2/12 completed


Learn more about TestLens at testlens.app.

@sbrannen sbrannen merged commit 1a16e08 into junit-team:main Mar 27, 2026
8 of 14 checks passed
@sbrannen
Copy link
Copy Markdown
Member

This has been merged into main.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants