Selected use of ArrayList instead of LinkedList in common places
See gh-25652
This commit is contained in:
@@ -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.
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.messaging.handler.invocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -37,7 +37,7 @@ import org.springframework.messaging.Message;
|
||||
*/
|
||||
public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgumentResolver {
|
||||
|
||||
private final List<HandlerMethodArgumentResolver> argumentResolvers = new LinkedList<>();
|
||||
private final List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<>();
|
||||
|
||||
private final Map<MethodParameter, HandlerMethodArgumentResolver> argumentResolverCache =
|
||||
new ConcurrentHashMap<>(256);
|
||||
|
||||
@@ -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.
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.messaging.handler.invocation.reactive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -42,7 +42,7 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final List<HandlerMethodArgumentResolver> argumentResolvers = new LinkedList<>();
|
||||
private final List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<>();
|
||||
|
||||
private final Map<MethodParameter, HandlerMethodArgumentResolver> argumentResolverCache =
|
||||
new ConcurrentHashMap<>(256);
|
||||
@@ -113,9 +113,8 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
|
||||
public Mono<Object> resolveArgument(MethodParameter parameter, Message<?> message) {
|
||||
HandlerMethodArgumentResolver resolver = getArgumentResolver(parameter);
|
||||
if (resolver == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unsupported parameter type [" + parameter.getParameterType().getName() + "]." +
|
||||
" supportsParameter should be called first.");
|
||||
throw new IllegalArgumentException("Unsupported parameter type [" +
|
||||
parameter.getParameterType().getName() + "]. supportsParameter should be called first.");
|
||||
}
|
||||
return resolver.resolveArgument(parameter, message);
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
package org.springframework.messaging.simp.stomp;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -228,15 +228,14 @@ public class StompEncoder {
|
||||
void add(byte b);
|
||||
|
||||
byte[] toByteArray();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class DefaultResult extends LinkedList<Object> implements Result {
|
||||
private static class DefaultResult extends ArrayList<Object> implements Result {
|
||||
|
||||
private int size;
|
||||
|
||||
|
||||
public void add(byte[] bytes) {
|
||||
this.size += bytes.length;
|
||||
super.add(bytes);
|
||||
|
||||
Reference in New Issue
Block a user