Here you can find the source of arrayToList(T[] array)
Parameter | Description |
---|---|
array | a parameter |
public static <T> ArrayList<T> arrayToList(T[] array)
//package com.java2s; import java.util.ArrayList; public class Main { /**/*from ww w . j a v a 2 s. c om*/ * Converts the generic array into an {@link ArrayList} of the same type. * * @param array * @return array list version */ public static <T> ArrayList<T> arrayToList(T[] array) { ArrayList<T> list = new ArrayList<T>(array.length); for (T element : array) { list.add(element); } return list; } }