Description
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; }
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.