Here you can find the source of toArrayList(final T... array)
Parameter | Description |
---|---|
array | A collection of elements to be included in the returned ArrayList |
public static <T> ArrayList<T> toArrayList(final T... array)
//package com.java2s; import java.util.ArrayList; import java.util.Collection; public class Main { /**/*w w w. j av a 2 s. c o m*/ * @param array A collection of elements to be included in the returned ArrayList * @return An ArrayList that includes all the elements passed in via the array parameter */ public static <T> ArrayList<T> toArrayList(final T... array) { final ArrayList<T> retValue = new ArrayList<T>(); for (final T item : array) retValue.add(item); return retValue; } /** * @param items The Collection of items to be converted to an ArrayList * @return An ArrayList containing the elements in the set */ public static <T> ArrayList<T> toArrayList(final Collection<T> items) { final ArrayList<T> retValue = new ArrayList<T>(); for (final T item : items) retValue.add(item); return retValue; } }