Replace remaining usage of LinkedList with ArrayList/ArrayDeque
Closes gh-25650
This commit is contained in:
@@ -21,7 +21,6 @@ import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@@ -403,7 +402,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
||||
Cache.ValueWrapper cacheHit = findCachedItem(contexts.get(CacheableOperation.class));
|
||||
|
||||
// Collect puts from any @Cacheable miss, if no cached item is found
|
||||
List<CachePutRequest> cachePutRequests = new LinkedList<>();
|
||||
List<CachePutRequest> cachePutRequests = new ArrayList<>();
|
||||
if (cacheHit == null) {
|
||||
collectPutRequests(contexts.get(CacheableOperation.class),
|
||||
CacheOperationExpressionEvaluator.NO_RESULT, cachePutRequests);
|
||||
|
||||
@@ -18,9 +18,9 @@ package org.springframework.context.annotation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -93,9 +93,9 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
|
||||
|
||||
private String resourcePattern = DEFAULT_RESOURCE_PATTERN;
|
||||
|
||||
private final List<TypeFilter> includeFilters = new LinkedList<>();
|
||||
private final List<TypeFilter> includeFilters = new ArrayList<>();
|
||||
|
||||
private final List<TypeFilter> excludeFilters = new LinkedList<>();
|
||||
private final List<TypeFilter> excludeFilters = new ArrayList<>();
|
||||
|
||||
@Nullable
|
||||
private Environment environment;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -21,9 +21,9 @@ import java.io.InputStream;
|
||||
import java.lang.instrument.ClassFileTransformer;
|
||||
import java.lang.instrument.IllegalClassFormatException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ShadowingClassLoader extends DecoratingClassLoader {
|
||||
|
||||
private final ClassLoader enclosingClassLoader;
|
||||
|
||||
private final List<ClassFileTransformer> classFileTransformers = new LinkedList<>();
|
||||
private final List<ClassFileTransformer> classFileTransformers = new ArrayList<>(1);
|
||||
|
||||
private final Map<String, Class<?>> classCache = new HashMap<>();
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ package org.springframework.validation;
|
||||
|
||||
import java.beans.PropertyEditor;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -50,7 +50,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||
|
||||
private MessageCodesResolver messageCodesResolver = new DefaultMessageCodesResolver();
|
||||
|
||||
private final List<ObjectError> errors = new LinkedList<>();
|
||||
private final List<ObjectError> errors = new ArrayList<>();
|
||||
|
||||
private final Map<String, Class<?>> fieldTypes = new HashMap<>();
|
||||
|
||||
@@ -145,7 +145,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||
|
||||
@Override
|
||||
public List<ObjectError> getGlobalErrors() {
|
||||
List<ObjectError> result = new LinkedList<>();
|
||||
List<ObjectError> result = new ArrayList<>();
|
||||
for (ObjectError objectError : this.errors) {
|
||||
if (!(objectError instanceof FieldError)) {
|
||||
result.add(objectError);
|
||||
@@ -167,7 +167,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||
|
||||
@Override
|
||||
public List<FieldError> getFieldErrors() {
|
||||
List<FieldError> result = new LinkedList<>();
|
||||
List<FieldError> result = new ArrayList<>();
|
||||
for (ObjectError objectError : this.errors) {
|
||||
if (objectError instanceof FieldError) {
|
||||
result.add((FieldError) objectError);
|
||||
@@ -189,7 +189,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||
|
||||
@Override
|
||||
public List<FieldError> getFieldErrors(String field) {
|
||||
List<FieldError> result = new LinkedList<>();
|
||||
List<FieldError> result = new ArrayList<>();
|
||||
String fixedField = fixedField(field);
|
||||
for (ObjectError objectError : this.errors) {
|
||||
if (objectError instanceof FieldError && isMatchingFieldError(fixedField, (FieldError) objectError)) {
|
||||
|
||||
@@ -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,9 +18,9 @@ package org.springframework.validation;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
@@ -146,7 +146,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
||||
|
||||
@Override
|
||||
public List<ObjectError> getAllErrors() {
|
||||
List<ObjectError> result = new LinkedList<>();
|
||||
List<ObjectError> result = new ArrayList<>();
|
||||
result.addAll(getGlobalErrors());
|
||||
result.addAll(getFieldErrors());
|
||||
return Collections.unmodifiableList(result);
|
||||
@@ -199,7 +199,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
||||
@Override
|
||||
public List<FieldError> getFieldErrors(String field) {
|
||||
List<FieldError> fieldErrors = getFieldErrors();
|
||||
List<FieldError> result = new LinkedList<>();
|
||||
List<FieldError> result = new ArrayList<>();
|
||||
String fixedField = fixedField(field);
|
||||
for (FieldError error : fieldErrors) {
|
||||
if (isMatchingFieldError(fixedField, error)) {
|
||||
|
||||
Reference in New Issue
Block a user