Use List.copyOf() instead of Collections.unmodifiableList()

See gh-42019
This commit is contained in:
문정환
2024-08-25 02:11:29 +09:00
committed by Phillip Webb
parent af2474b7ad
commit 08106b5a69

View File

@@ -16,7 +16,6 @@
package org.springframework.boot.jdbc.metadata;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -40,8 +39,7 @@ public class CompositeDataSourcePoolMetadataProvider implements DataSourcePoolMe
* @param providers the data source pool metadata providers
*/
public CompositeDataSourcePoolMetadataProvider(Collection<? extends DataSourcePoolMetadataProvider> providers) {
this.providers = (providers != null) ? Collections.unmodifiableList(new ArrayList<>(providers))
: Collections.emptyList();
this.providers = (providers != null) ? List.copyOf(providers) : Collections.emptyList();
}
@Override