Here you can find the source of toArray(List
Parameter | Description |
---|---|
list | the list of integers |
public static int[] toArray(List<Integer> list)
//package com.java2s; //License from project: LGPL import java.util.List; public class Main { /**//from ww w.j ava2s. c o m * Converts a list of integers to an array * * @param list * the list of integers * @return the converted array of integers */ public static int[] toArray(List<Integer> list) { int[] array = new int[list.size()]; for (int i = 0, l = list.size(); i < l; i++) array[i] = list.get(i); return array; } }