[COLLECTIONS-666] org.apache.commons.collections4.ListUtils.union(List,
List) should pre-allocate result list
This commit is contained in:
parent
45f42120a6
commit
2fd2a76110
|
@ -66,6 +66,9 @@
|
|||
<action issue="COLLECTIONS-654" dev="ggregory" type="add">
|
||||
Add class SortedProperties to sort keys.
|
||||
</action>
|
||||
<action issue="COLLECTIONS-666" dev="ggregory" type="update" due-to="BELUGA BEHR">
|
||||
org.apache.commons.collections4.ListUtils.union(List, List) should pre-allocate result list.
|
||||
</action>
|
||||
</release>
|
||||
<release version="4.1" date="2015-11-28" description="This is a security and minor release.">
|
||||
<action issue="COLLECTIONS-508" dev="tn" type="add">
|
||||
|
|
|
@ -159,7 +159,8 @@ public class ListUtils {
|
|||
* @throws NullPointerException if either list is null
|
||||
*/
|
||||
public static <E> List<E> union(final List<? extends E> list1, final List<? extends E> list2) {
|
||||
final ArrayList<E> result = new ArrayList<>(list1);
|
||||
final ArrayList<E> result = new ArrayList<>(list1.size() + list2.size());
|
||||
result.addAll(list1);
|
||||
result.addAll(list2);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue