From 75b6540bd8163d93a07d6be63927a68e1bfc8af1 Mon Sep 17 00:00:00 2001 From: Qimiao Chen Date: Thu, 4 Mar 2021 19:09:45 +0800 Subject: [PATCH] Specify 20 to the initial size of the ArrayList --- .../main/java/org/springframework/util/ReflectionUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java index 6b457daaa3..c38e0bca39 100644 --- a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java @@ -384,7 +384,7 @@ public abstract class ReflectionUtils { * @throws IllegalStateException if introspection fails */ public static Method[] getAllDeclaredMethods(Class leafClass) { - final List methods = new ArrayList<>(32); + final List methods = new ArrayList<>(20); doWithMethods(leafClass, methods::add); return methods.toArray(EMPTY_METHOD_ARRAY); } @@ -410,7 +410,7 @@ public abstract class ReflectionUtils { * @since 5.2 */ public static Method[] getUniqueDeclaredMethods(Class leafClass, @Nullable MethodFilter mf) { - final List methods = new ArrayList<>(32); + final List methods = new ArrayList<>(20); doWithMethods(leafClass, method -> { boolean knownSignature = false; Method methodBeingOverriddenWithCovariantReturnType = null;