Skip to content

Commit 7ef8cc9

Browse files
stsypanovsbrannen
authored andcommitted
Tiny improvements regarding ArrayList creation
Closes gh-23047
1 parent f492e37 commit 7ef8cc9

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ public TypedValue getValueInternal(ExpressionState expressionState) throws Evalu
9292
return this.constant;
9393
}
9494
else {
95-
List<Object> returnValue = new ArrayList<>();
9695
int childCount = getChildCount();
96+
List<Object> returnValue = new ArrayList<>(childCount);
9797
for (int c = 0; c < childCount; c++) {
9898
returnValue.add(getChild(c).getValue(expressionState));
9999
}

spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ private static Map<Class<? extends Throwable>, Method> initExceptionMappings(Cla
5656
Map<Class<? extends Throwable>, Method> result = new HashMap<>();
5757
for (Map.Entry<Method, MessageExceptionHandler> entry : methods.entrySet()) {
5858
Method method = entry.getKey();
59-
List<Class<? extends Throwable>> exceptionTypes = new ArrayList<>();
60-
exceptionTypes.addAll(Arrays.asList(entry.getValue().value()));
59+
List<Class<? extends Throwable>> exceptionTypes = new ArrayList<>(Arrays.asList(entry.getValue().value()));
6160
if (exceptionTypes.isEmpty()) {
6261
exceptionTypes.addAll(getExceptionsFromMethodSignature(method));
6362
}

0 commit comments

Comments
 (0)