Skip to content

Commit 844a8d8

Browse files
lijunyzzZsnicoll
authored andcommitted
Simplify some code
See spring-projectsgh-17832
1 parent 835108e commit 844a8d8

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ private ConfigurationBeanFactoryMetadata getBeanFactoryMetadata(ApplicationConte
131131

132132
private Map<String, Object> getConfigurationPropertiesBeans(ApplicationContext context,
133133
ConfigurationBeanFactoryMetadata beanFactoryMetadata) {
134-
Map<String, Object> beans = new HashMap<>();
135-
beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class));
134+
Map<String, Object> beans = new HashMap<>(context.getBeansWithAnnotation(ConfigurationProperties.class));
136135
if (beanFactoryMetadata != null) {
137136
beans.putAll(beanFactoryMetadata.getBeansWithFactoryAnnotation(ConfigurationProperties.class));
138137
}

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ private String[] tokenizePathSegments(String path) {
332332
}
333333

334334
private Map<String, Object> getArguments(ServerWebExchange exchange, Map<String, String> body) {
335-
Map<String, Object> arguments = new LinkedHashMap<>();
336-
arguments.putAll(getTemplateVariables(exchange));
335+
Map<String, Object> arguments = new LinkedHashMap<>(getTemplateVariables(exchange));
337336
if (body != null) {
338337
arguments.putAll(body);
339338
}

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,7 @@ public String toString() {
310310
}
311311

312312
private Map<String, Object> getArguments(HttpServletRequest request, Map<String, String> body) {
313-
Map<String, Object> arguments = new LinkedHashMap<>();
314-
arguments.putAll(getTemplateVariables(request));
313+
Map<String, Object> arguments = new LinkedHashMap<>(getTemplateVariables(request));
315314
String matchAllRemainingPathSegmentsVariable = this.operation.getRequestPredicate()
316315
.getMatchAllRemainingPathSegmentsVariable();
317316
if (matchAllRemainingPathSegmentsVariable != null) {

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/Info.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public final class Info {
4040
private final Map<String, Object> details;
4141

4242
private Info(Builder builder) {
43-
Map<String, Object> content = new LinkedHashMap<>();
44-
content.putAll(builder.content);
43+
Map<String, Object> content = new LinkedHashMap<>(builder.content);
4544
this.details = Collections.unmodifiableMap(content);
4645
}
4746

Diff for: spring-boot-project/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private void appendOn(StringBuilder message) {
126126
}
127127

128128
private void appendPid(StringBuilder message) {
129-
append(message, "with PID ", () -> new ApplicationPid());
129+
append(message, "with PID ", ApplicationPid::new);
130130
}
131131

132132
private void appendContext(StringBuilder message) {

0 commit comments

Comments
 (0)