Skip to content

Commit dbbdd04

Browse files
chenqimiaosnicoll
authored andcommitted
Use Collections.addAll instead of Collection.addAll
See spring-projectsgh-24636
1 parent 5532615 commit dbbdd04

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

spring-core/src/main/java/org/springframework/util/CollectionUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ public static List<?> arrayToList(@Nullable Object source) {
129129
@SuppressWarnings("unchecked")
130130
public static <E> void mergeArrayIntoCollection(@Nullable Object array, Collection<E> collection) {
131131
Object[] arr = ObjectUtils.toObjectArray(array);
132-
for (Object elem : arr) {
133-
collection.add((E) elem);
134-
}
132+
Collections.addAll(collection, (E[])arr);
135133
}
136134

137135
/**

0 commit comments

Comments
 (0)