Skip to content

[Performance] Replace Collections.EMPTY_* with empty*() to avoid unchecked warnings#13724

Merged
wu-sheng merged 2 commits intoapache:masterfrom
Senrian:fix/collections-empty-usage
Mar 6, 2026
Merged

[Performance] Replace Collections.EMPTY_* with empty*() to avoid unchecked warnings#13724
wu-sheng merged 2 commits intoapache:masterfrom
Senrian:fix/collections-empty-usage

Conversation

@Senrian
Copy link
Contributor

@Senrian Senrian commented Mar 3, 2026

Description

Replace deprecated Collections.EMPTY_* static fields with modern empty*() factory methods to avoid raw type warnings and improve code quality.

Changes

  • Replace Collections.EMPTY_MAP with Collections.emptyMap()
  • Replace Collections.EMPTY_LIST with Collections.emptyList()
  • Replace Collections.EMPTY_SET with Collections.emptySet()

Benefits

  • Eliminates unchecked type warnings
  • Follows modern Java best practices
  • More readable and maintainable code

Testing

  • Local build passed

Senrian and others added 2 commits March 3, 2026 16:36
…nings

Replace deprecated Collections.EMPTY_LIST and Collections.EMPTY_MAP
with Collections.emptyList() and Collections.emptyMap() to eliminate
unchecked generic type warnings in Java.

Changes:
- TopNWorker.java: Collections.EMPTY_LIST -> Collections.emptyList()
- RulesReader.java: Collections.EMPTY_MAP -> Collections.emptyMap()
@wu-sheng wu-sheng added the chore Chores about the project, like code cleaning up, typos, upgrading dependencies, etc. label Mar 6, 2026
@wu-sheng wu-sheng added this to the 10.4.0 milestone Mar 6, 2026
@wu-sheng wu-sheng merged commit c55f576 into apache:master Mar 6, 2026
326 of 328 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Chores about the project, like code cleaning up, typos, upgrading dependencies, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants