Here you can find the source of toIntArray(List
Parameter | Description |
---|---|
list | a parameter |
public final static int[] toIntArray(List<Integer> list)
//package com.java2s; import java.util.*; public class Main { /**//from w w w .j a v a2s . com * Converts a List of Integer to an int[] * @param list * @return an array of int */ public final static int[] toIntArray(List<Integer> list) { int[] res = new int[list.size()]; int index = 0; Iterator iter = list.iterator(); while (iter.hasNext()) { Integer i = (Integer) iter.next(); res[index++] = i.intValue(); } return res; } }