Replace Collections.unmodifiableList(new ArrayList(..)) with List.copyOf() (#30166)
This commit is contained in:
@@ -19,7 +19,6 @@ package org.springframework.http.converter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -100,7 +99,7 @@ public abstract class AbstractHttpMessageConverter<T> implements HttpMessageConv
|
||||
*/
|
||||
public void setSupportedMediaTypes(List<MediaType> supportedMediaTypes) {
|
||||
Assert.notEmpty(supportedMediaTypes, "MediaType List must not be empty");
|
||||
this.supportedMediaTypes = Collections.unmodifiableList(new ArrayList<>(supportedMediaTypes));
|
||||
this.supportedMediaTypes = List.copyOf(supportedMediaTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -949,7 +949,7 @@ final class HierarchicalUriComponents extends UriComponents {
|
||||
|
||||
public PathSegmentComponent(List<String> pathSegments) {
|
||||
Assert.notNull(pathSegments, "List must not be null");
|
||||
this.pathSegments = Collections.unmodifiableList(new ArrayList<>(pathSegments));
|
||||
this.pathSegments = List.copyOf(pathSegments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user