Merge pull request #17832 from succezlijunyi

* pr/17832:
  Simplify some code

Closes gh-17832
pull/17834/head
Stephane Nicoll 5 years ago
commit 6777a437d4

@ -131,8 +131,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
private Map<String, Object> getConfigurationPropertiesBeans(ApplicationContext context,
ConfigurationBeanFactoryMetadata beanFactoryMetadata) {
Map<String, Object> beans = new HashMap<>();
beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class));
Map<String, Object> beans = new HashMap<>(context.getBeansWithAnnotation(ConfigurationProperties.class));
if (beanFactoryMetadata != null) {
beans.putAll(beanFactoryMetadata.getBeansWithFactoryAnnotation(ConfigurationProperties.class));
}

@ -332,8 +332,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping extends RequestMappi
}
private Map<String, Object> getArguments(ServerWebExchange exchange, Map<String, String> body) {
Map<String, Object> arguments = new LinkedHashMap<>();
arguments.putAll(getTemplateVariables(exchange));
Map<String, Object> arguments = new LinkedHashMap<>(getTemplateVariables(exchange));
if (body != null) {
arguments.putAll(body);
}

@ -310,8 +310,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
}
private Map<String, Object> getArguments(HttpServletRequest request, Map<String, String> body) {
Map<String, Object> arguments = new LinkedHashMap<>();
arguments.putAll(getTemplateVariables(request));
Map<String, Object> arguments = new LinkedHashMap<>(getTemplateVariables(request));
String matchAllRemainingPathSegmentsVariable = this.operation.getRequestPredicate()
.getMatchAllRemainingPathSegmentsVariable();
if (matchAllRemainingPathSegmentsVariable != null) {

@ -40,8 +40,7 @@ public final class Info {
private final Map<String, Object> details;
private Info(Builder builder) {
Map<String, Object> content = new LinkedHashMap<>();
content.putAll(builder.content);
Map<String, Object> content = new LinkedHashMap<>(builder.content);
this.details = Collections.unmodifiableMap(content);
}

@ -126,7 +126,7 @@ class StartupInfoLogger {
}
private void appendPid(StringBuilder message) {
append(message, "with PID ", () -> new ApplicationPid());
append(message, "with PID ", ApplicationPid::new);
}
private void appendContext(StringBuilder message) {

Loading…
Cancel
Save