Java examples for java.util:List Creation
Creates a list from the vararg specified items in the order they were specified.
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { /**/*from www .ja v a 2 s. co m*/ * Creates a list from the vararg specified items in the order they were * specified. * * @param <T> * type of item in the list * * @param items * array of items to be added to the list * * @return * a list containing all the items supplied in the order supplied order */ public static <T> List<T> newList(T... items) { List<T> list = new ArrayList<T>(items.length); for (T t : items) { list.add(t); } return list; } }