Specify 20 to the initial size of the ArrayList

This commit is contained in:
Qimiao Chen
2021-03-04 19:09:45 +08:00
committed by Juergen Hoeller
parent 21d77dd7c7
commit 75b6540bd8

View File

@@ -384,7 +384,7 @@ public abstract class ReflectionUtils {
* @throws IllegalStateException if introspection fails
*/
public static Method[] getAllDeclaredMethods(Class<?> leafClass) {
final List<Method> methods = new ArrayList<>(32);
final List<Method> 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<Method> methods = new ArrayList<>(32);
final List<Method> methods = new ArrayList<>(20);
doWithMethods(leafClass, method -> {
boolean knownSignature = false;
Method methodBeingOverriddenWithCovariantReturnType = null;