Simplify some code

See gh-17832
This commit is contained in:
lijuny 2019-08-11 07:25:28 +08:00 committed by Stephane Nicoll
parent 835108e522
commit 844a8d8027
5 changed files with 5 additions and 9 deletions

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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) {

View File

@ -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);
}

View File

@ -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) {