Here you can find the source of asList(T[] array)
Parameter | Description |
---|---|
array | a parameter |
public static <T> ArrayList<T> asList(T[] array)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; public class Main { /**/*from w w w. j a v a 2s.c o m*/ * Given an input array, will return an ArrayList representation of the array. * * @param array * @return the ArrayList corresponding to the input array. If the input is null, this also returns null. If it is empty * then this will return an empty list */ public static <T> ArrayList<T> asList(T[] array) { if (array == null) { return null; } ArrayList<T> list = new ArrayList<T>(array.length); for (T e : array) { list.add(e); } return list; } }