Skip to content

Conversation

bazzi2548
Copy link
Contributor

We can safely use List.copyOf() because we check if (providers) is null.

If use List.copyOf()

  • Clean code
  • Performance optimization
  • Guarantees a truly immutable list.

We can safely use List.copyOf() because we check if (providers) is null.

If use List.copyOf()
- Clean code
- Performance optimization
- Guarantees a truly immutable list.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 24, 2024
@philwebb
Copy link
Member

I think this is probably safe, but we need to be a little careful using List.copyOf. Unlike Collections.unmodifiableList(new ArrayList<>(...)) it will throw an exception if any of the elements are null.

@philwebb philwebb added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 24, 2024
@philwebb philwebb added this to the 3.4.x milestone Aug 24, 2024
@philwebb philwebb closed this in 1ba0113 Sep 2, 2024
@philwebb philwebb modified the milestones: 3.4.x, 3.4.0-M3 Sep 2, 2024
@philwebb
Copy link
Member

philwebb commented Sep 2, 2024

Thanks @bazzi2548!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants