Here you can find the source of createList(T... element)
Parameter | Description |
---|---|
element | the item to add to the list |
public static <T> List<T> createList(T... element)
//package com.java2s; /**// ww w .j av a 2 s . co m * Sencha GXT 3.0.1 - Sencha for GWT * Copyright(c) 2007-2012, Sencha, Inc. * licensing@sencha.com * * http://www.sencha.com/products/gxt/license/ */ import java.util.ArrayList; import java.util.List; public class Main { /** * Creates a new list and adds the element(s). * * @param element the item to add to the list * @return the new list */ public static <T> List<T> createList(T... element) { List<T> list = new ArrayList<T>(); fill(list, element); return list; } /** * Populates a list with an array of elements. * * @param list the list * @param elements the elements to be added to the list */ public static <T> void fill(List<T> list, T[] elements) { for (int i = 0; i < elements.length; i++) { list.add(elements[i]); } } }