Here you can find the source of asArray(List
Parameter | Description |
---|---|
T | Type of list elements |
list | Basic list for operation |
list
public static <T> T[] asArray(List<T> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**/*from w w w.j ava 2 s. co m*/ * Converts a list to an array of the same type. * * @param <T> * Type of list elements * @param list * Basic list for operation * @return An array of the same type containing all elements of * <code>list</code> */ public static <T> T[] asArray(List<T> list) { return (T[]) list.toArray(); } }