BELUGA BEHR created COLLECTIONS-666:
---------------------------------------

             Summary: ListUtils Union Method
                 Key: COLLECTIONS-666
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-666
             Project: Commons Collections
          Issue Type: Improvement
    Affects Versions: 4.2
            Reporter: BELUGA BEHR
            Priority: Trivial


{code}
public static <E> List<E> union(final List<? extends E> list1, final List<? 
extends E> list2) {
        final ArrayList<E> result = new ArrayList<E>(list1);
        result.addAll(list2);
        return result;
}
{code}

Maybe we should create the _result_ list with the size of list1 + list 2, then 
perform two add all.  This will prevent the ArrayList from being re-sized on 
the addAll step.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to