Java examples for Collection Framework:List
List union
//package com.java2s; import java.util.*; public class Main { public static <T> List<T> union(List<T> list1, List<T> list2) { Set<T> set = new TreeSet<T>(); set.addAll(list1);/*from w w w.j a v a 2s. c o m*/ set.addAll(list2); return new ArrayList<T>(set); } }