Replace remaining usage of LinkedList with ArrayList/ArrayDeque

Closes gh-25650
This commit is contained in:
Juergen Hoeller
2020-08-26 18:32:08 +02:00
parent d198c4426f
commit 874574513c
65 changed files with 239 additions and 239 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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,10 +18,10 @@ package org.springframework.orm.jpa.persistenceunit;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -498,7 +498,7 @@ public class DefaultPersistenceUnitManager
* as defined in the JPA specification.
*/
private List<SpringPersistenceUnitInfo> readPersistenceUnitInfos() {
List<SpringPersistenceUnitInfo> infos = new LinkedList<>();
List<SpringPersistenceUnitInfo> infos = new ArrayList<>(1);
String defaultName = this.defaultPersistenceUnitName;
boolean buildDefaultUnit = (this.packagesToScan != null || this.mappingResources != null);
boolean foundDefaultUnit = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2020 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,7 +17,7 @@
package org.springframework.orm.jpa.persistenceunit;
import java.net.URL;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@@ -61,16 +61,16 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
@Nullable
private DataSource jtaDataSource;
private final List<String> mappingFileNames = new LinkedList<>();
private final List<String> mappingFileNames = new ArrayList<>();
private List<URL> jarFileUrls = new LinkedList<>();
private final List<URL> jarFileUrls = new ArrayList<>();
@Nullable
private URL persistenceUnitRootUrl;
private final List<String> managedClassNames = new LinkedList<>();
private final List<String> managedClassNames = new ArrayList<>();
private final List<String> managedPackages = new LinkedList<>();
private final List<String> managedPackages = new ArrayList<>();
private boolean excludeUnlistedClasses = false;

View File

@@ -19,7 +19,7 @@ package org.springframework.orm.jpa.persistenceunit;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.SharedCacheMode;
@@ -123,7 +123,7 @@ final class PersistenceUnitReader {
*/
public SpringPersistenceUnitInfo[] readPersistenceUnitInfos(String[] persistenceXmlLocations) {
ErrorHandler handler = new SimpleSaxErrorHandler(logger);
List<SpringPersistenceUnitInfo> infos = new LinkedList<>();
List<SpringPersistenceUnitInfo> infos = new ArrayList<>(1);
String resourceLocation = null;
try {
for (String location : persistenceXmlLocations) {

View File

@@ -24,7 +24,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -403,7 +402,7 @@ public class PersistenceAnnotationBeanPostProcessor
Class<?> targetClass = clazz;
do {
final LinkedList<InjectionMetadata.InjectedElement> currElements = new LinkedList<>();
final List<InjectionMetadata.InjectedElement> currElements = new ArrayList<>();
ReflectionUtils.doWithLocalFields(targetClass, field -> {
if (field.isAnnotationPresent(PersistenceContext.class) ||