Replace single operations inside loops with bulk methods
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 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.
|
||||
@@ -112,9 +112,7 @@ public abstract class AbstractApplicationContextFactory implements ApplicationCo
|
||||
public void setBeanFactoryPostProcessorClasses(
|
||||
Class<? extends BeanFactoryPostProcessor>[] beanFactoryPostProcessorClasses) {
|
||||
this.beanFactoryPostProcessorClasses = new ArrayList<>();
|
||||
for (int i = 0; i < beanFactoryPostProcessorClasses.length; i++) {
|
||||
this.beanFactoryPostProcessorClasses.add(beanFactoryPostProcessorClasses[i]);
|
||||
}
|
||||
this.beanFactoryPostProcessorClasses.addAll(Arrays.asList(beanFactoryPostProcessorClasses));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,9 +125,7 @@ public abstract class AbstractApplicationContextFactory implements ApplicationCo
|
||||
*/
|
||||
public void setBeanPostProcessorExcludeClasses(Class<?>[] beanPostProcessorExcludeClasses) {
|
||||
this.beanPostProcessorExcludeClasses = new ArrayList<>();
|
||||
for (int i = 0; i < beanPostProcessorExcludeClasses.length; i++) {
|
||||
this.beanPostProcessorExcludeClasses.add(beanPostProcessorExcludeClasses[i]);
|
||||
}
|
||||
this.beanPostProcessorExcludeClasses.addAll(Arrays.asList(beanPostProcessorExcludeClasses));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 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,6 +17,7 @@
|
||||
package org.springframework.batch.core.configuration.support;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
@@ -91,9 +92,7 @@ public class AutomaticJobRegistrar implements Ordered, SmartLifecycle, Applicati
|
||||
* use
|
||||
*/
|
||||
public void setApplicationContextFactories(ApplicationContextFactory[] applicationContextFactories) {
|
||||
for (ApplicationContextFactory applicationContextFactory : applicationContextFactories) {
|
||||
this.applicationContextFactories.add(applicationContextFactory);
|
||||
}
|
||||
this.applicationContextFactories.addAll(Arrays.asList(applicationContextFactories));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 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.
|
||||
@@ -666,10 +666,7 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addNonSkippableExceptionIfMissing(Class<? extends Throwable>... cls) {
|
||||
List<Class<? extends Throwable>> exceptions = new ArrayList<>();
|
||||
for (Class<? extends Throwable> exceptionClass : nonSkippableExceptionClasses) {
|
||||
exceptions.add(exceptionClass);
|
||||
}
|
||||
List<Class<? extends Throwable>> exceptions = new ArrayList<>(nonSkippableExceptionClasses);
|
||||
for (Class<? extends Throwable> fatal : cls) {
|
||||
if (!exceptions.contains(fatal)) {
|
||||
exceptions.add(fatal);
|
||||
@@ -680,10 +677,7 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addNonRetryableExceptionIfMissing(Class<? extends Throwable>... cls) {
|
||||
List<Class<? extends Throwable>> exceptions = new ArrayList<>();
|
||||
for (Class<? extends Throwable> exceptionClass : nonRetryableExceptionClasses) {
|
||||
exceptions.add(exceptionClass);
|
||||
}
|
||||
List<Class<? extends Throwable>> exceptions = new ArrayList<>(nonRetryableExceptionClasses);
|
||||
for (Class<? extends Throwable> fatal : cls) {
|
||||
if (!exceptions.contains(fatal)) {
|
||||
exceptions.add(fatal);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 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.
|
||||
@@ -22,6 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,6 +39,7 @@ import org.springframework.batch.core.job.flow.StateSupport;
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
class SimpleFlowTests {
|
||||
@@ -208,13 +210,7 @@ class SimpleFlowTests {
|
||||
}
|
||||
|
||||
protected List<StateTransition> collect(StateTransition... states) {
|
||||
List<StateTransition> list = new ArrayList<>();
|
||||
|
||||
for (StateTransition stateTransition : states) {
|
||||
list.add(stateTransition);
|
||||
}
|
||||
|
||||
return list;
|
||||
return new ArrayList<>(Arrays.asList(states));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user