public static < T > List < T > mergeLists ( List < T > list1 , List < T > list2 ) { List < T > merged = new LinkedList < T > ( ) ; if ( list1 != null ) { merged . addAll ( list1 ) ; } if ( list2 != null ) { merged . addAll ( list2 ) ; } return merged ; }
Returns a new list containing the second list appended to the first list .