Prefer Collections.addAll call with array over Set.addAll(Arrays.asList)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -18,7 +18,7 @@ package org.springframework.context.annotation;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -114,7 +114,7 @@ class ComponentScanAnnotationParser {
|
||||
for (String pkg : basePackagesArray) {
|
||||
String[] tokenized = StringUtils.tokenizeToStringArray(this.environment.resolvePlaceholders(pkg),
|
||||
ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS);
|
||||
basePackages.addAll(Arrays.asList(tokenized));
|
||||
Collections.addAll(basePackages, tokenized);
|
||||
}
|
||||
for (Class<?> clazz : componentScan.getClassArray("basePackageClasses")) {
|
||||
basePackages.add(ClassUtils.getPackageName(clazz));
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.jmx.export;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -321,7 +321,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
||||
*/
|
||||
public void setExcludedBeans(String... excludedBeans) {
|
||||
this.excludedBeans.clear();
|
||||
this.excludedBeans.addAll(Arrays.asList(excludedBeans));
|
||||
Collections.addAll(this.excludedBeans, excludedBeans);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -868,9 +868,9 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
||||
private void autodetect(Map<String, Object> beans, AutodetectCallback callback) {
|
||||
Assert.state(this.beanFactory != null, "No BeanFactory set");
|
||||
Set<String> beanNames = new LinkedHashSet<>(this.beanFactory.getBeanDefinitionCount());
|
||||
beanNames.addAll(Arrays.asList(this.beanFactory.getBeanDefinitionNames()));
|
||||
Collections.addAll(beanNames, this.beanFactory.getBeanDefinitionNames());
|
||||
if (this.beanFactory instanceof ConfigurableBeanFactory) {
|
||||
beanNames.addAll(Arrays.asList(((ConfigurableBeanFactory) this.beanFactory).getSingletonNames()));
|
||||
Collections.addAll(beanNames, ((ConfigurableBeanFactory) this.beanFactory).getSingletonNames());
|
||||
}
|
||||
|
||||
for (String beanName : beanNames) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.jndi.support;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@@ -92,7 +92,7 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac
|
||||
* (typically within the "java:comp/env/" namespace)
|
||||
*/
|
||||
public void setShareableResources(String... shareableResources) {
|
||||
this.shareableResources.addAll(Arrays.asList(shareableResources));
|
||||
Collections.addAll(this.shareableResources, shareableResources);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user