Here you can find the source of union(final List extends E> list1, final List extends E> list2)
public static <E> List<E> union(final List<? extends E> list1, final List<? extends E> list2)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static <E> List<E> union(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(list1.size() + list2.size()); result.addAll(list1);//from w ww . jav a 2s .c om result.addAll(list2); return result; } }