Tiny improvements regarding ArrayList creation

Closes gh-23047
This commit is contained in:
Сергей Цыпанов 2019-05-28 17:08:58 +03:00 committed by Sam Brannen
parent f492e37370
commit 7ef8cc9faf
2 changed files with 2 additions and 3 deletions

View File

@ -92,8 +92,8 @@ public class InlineList extends SpelNodeImpl {
return this.constant;
}
else {
List<Object> returnValue = new ArrayList<>();
int childCount = getChildCount();
List<Object> returnValue = new ArrayList<>(childCount);
for (int c = 0; c < childCount; c++) {
returnValue.add(getChild(c).getValue(expressionState));
}

View File

@ -56,8 +56,7 @@ public class AnnotationExceptionHandlerMethodResolver extends AbstractExceptionH
Map<Class<? extends Throwable>, Method> result = new HashMap<>();
for (Map.Entry<Method, MessageExceptionHandler> entry : methods.entrySet()) {
Method method = entry.getKey();
List<Class<? extends Throwable>> exceptionTypes = new ArrayList<>();
exceptionTypes.addAll(Arrays.asList(entry.getValue().value()));
List<Class<? extends Throwable>> exceptionTypes = new ArrayList<>(Arrays.asList(entry.getValue().value()));
if (exceptionTypes.isEmpty()) {
exceptionTypes.addAll(getExceptionsFromMethodSignature(method));
}