Skip to content

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Oct 22, 2025

What changes were proposed in this pull request?

This PR aims to use Java 9+ Map.of and Set.of APIs instead of the following.

  • Collections.emptySet
  • Collections.emptyMap
  • Collections.singletonMap
  • Collections.singletonSet

Why are the changes needed?

New Java APIs are concise and more intuitive.

- return Collections.emptyMap();
+ return Map.of();
- Collections.singletonMap(getCurrentStateId() + 1, state),
+ Map.of(getCurrentStateId() + 1, state),

In addition, this is aligned with

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Pass the CIs.

Was this patch authored or co-authored using generative AI tooling?

No.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-53990] Use Java (Map|Set).of instead of Collections.(empty|singleton)(Set|Map) [SPARK-53990] Use Java (Map|Set).of instead of Collections.(empty|singleton)(Map|Set) Oct 22, 2025
@dongjoon-hyun
Copy link
Member Author

All tests passed. Let me merge this since this is a straight-forward replacement.

@dongjoon-hyun dongjoon-hyun deleted the SPARK-53990 branch October 22, 2025 21:09
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.

1 participant