diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java index bab02ebb3c..90a2a07b95 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java @@ -17,10 +17,8 @@ package org.springframework.boot.actuate.endpoint.web.reactive; import java.lang.reflect.Method; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; @@ -95,7 +93,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi ExposableControllerEndpoint endpoint, RequestMappingInfo mapping) { Set patterns = mapping.getPatternsCondition().getPatterns(); if (patterns.isEmpty()) { - patterns = new HashSet<>(Arrays.asList(getPathPatternParser().parse(""))); + patterns = Collections.singleton(getPathPatternParser().parse("")); } PathPattern[] endpointMappedPatterns = patterns.stream() .map((pattern) -> getEndpointMappedPattern(endpoint, pattern)) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java index a8a169b0a6..9466a76a25 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java @@ -19,7 +19,6 @@ package org.springframework.boot.actuate.endpoint.web.servlet; import java.lang.reflect.Method; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -95,7 +94,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi ExposableControllerEndpoint endpoint, RequestMappingInfo mapping) { Set patterns = mapping.getPatternsCondition().getPatterns(); if (patterns.isEmpty()) { - patterns = new HashSet<>(Collections.singletonList("")); + patterns = Collections.singleton(""); } String[] endpointMappedPatterns = patterns.stream() .map((pattern) -> getEndpointMappedPattern(endpoint, pattern)) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java index 56219d4e6e..1f19075022 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java @@ -20,9 +20,7 @@ import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.StringWriter; import java.time.Duration; -import java.util.Arrays; import java.util.Collections; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -97,8 +95,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor static final String LOMBOK_ACCESS_LEVEL_PUBLIC = "PUBLIC"; - private static final Set SUPPORTED_OPTIONS = Collections.unmodifiableSet( - new HashSet<>(Arrays.asList(ADDITIONAL_METADATA_LOCATIONS_OPTION))); + private static final Set SUPPORTED_OPTIONS = Collections + .unmodifiableSet(Collections.singleton(ADDITIONAL_METADATA_LOCATIONS_OPTION)); private MetadataStore metadataStore; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java index f16d6ec514..ba4b7ccf94 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java @@ -23,9 +23,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.StandardCharsets; -import java.util.Arrays; import java.util.Collections; -import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; @@ -48,7 +46,7 @@ public class DefaultLaunchScript implements LaunchScript { .compile("\\{\\{(\\w+)(:.*?)?\\}\\}(?!\\})"); private static final Set FILE_PATH_KEYS = Collections - .unmodifiableSet(new HashSet<>(Arrays.asList("inlinedConfScript"))); + .unmodifiableSet(Collections.singleton("inlinedConfScript")); private final String content;