Java examples for Collection Framework:List
Combines the elements of various lists into one list.
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { /**//from w w w . j a v a 2 s .c o m * Combines the elements of various lists into one list. * * @param <T> Type of the elements in the list. * @param lists The lists to combine. * * @return The list created from the elements of all input lists. */ public static <T> List<T> combine(final List<T>... lists) { final List<T> list = new ArrayList<T>(); for (final List<T> inputList : lists) { list.addAll(inputList); } return list; } }