Use Set.of instead of HashSet with Arrays.asList
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package org.springframework.context.annotation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -371,7 +370,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||
candidates.clear();
|
||||
if (registry.getBeanDefinitionCount() > candidateNames.length) {
|
||||
String[] newCandidateNames = registry.getBeanDefinitionNames();
|
||||
Set<String> oldCandidateNames = new HashSet<>(Arrays.asList(candidateNames));
|
||||
Set<String> oldCandidateNames = Set.of(candidateNames);
|
||||
Set<String> alreadyParsedClasses = new HashSet<>();
|
||||
for (ConfigurationClass configurationClass : alreadyParsed) {
|
||||
alreadyParsedClasses.add(configurationClass.getMetadata().getClassName());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,10 +17,8 @@
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
@@ -72,7 +70,7 @@ public class MethodExclusionMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
* @see #setIgnoredMethodMappings(java.util.Properties)
|
||||
*/
|
||||
public void setIgnoredMethods(String... ignoredMethodNames) {
|
||||
this.ignoredMethods = new HashSet<>(Arrays.asList(ignoredMethodNames));
|
||||
this.ignoredMethods = Set.of(ignoredMethodNames);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +85,7 @@ public class MethodExclusionMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
for (Enumeration<?> en = mappings.keys(); en.hasMoreElements();) {
|
||||
String beanKey = (String) en.nextElement();
|
||||
String[] methodNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
|
||||
this.ignoredMethodMappings.put(beanKey, new HashSet<>(Arrays.asList(methodNames)));
|
||||
this.ignoredMethodMappings.put(beanKey, Set.of(methodNames));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,10 +17,8 @@
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
@@ -76,7 +74,7 @@ public class MethodNameBasedMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
* @see #setMethodMappings
|
||||
*/
|
||||
public void setManagedMethods(String... methodNames) {
|
||||
this.managedMethods = new HashSet<>(Arrays.asList(methodNames));
|
||||
this.managedMethods = Set.of(methodNames);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +89,7 @@ public class MethodNameBasedMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
for (Enumeration<?> en = mappings.keys(); en.hasMoreElements();) {
|
||||
String beanKey = (String) en.nextElement();
|
||||
String[] methodNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
|
||||
this.methodMappings.put(beanKey, new HashSet<>(Arrays.asList(methodNames)));
|
||||
this.methodMappings.put(beanKey, Set.of(methodNames));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user