Here you can find the source of toIntArray(List
Parameter | Description |
---|---|
list | The list to convert |
public static int[] toIntArray(List<Integer> list)
//package com.java2s; import java.util.List; public class Main { /**/* w w w .j a v a 2s.com*/ * This converts a list to it's primitive state. * In this case, it converts an {@link Integer} list to a * int array. * * @param list The list to convert * @return The primitive array instance of the list's contents. */ public static int[] toIntArray(List<Integer> list) { int[] array = new int[list.size()]; for (int i = 0; i < list.size(); i++) { array[i] = list.get(i); } return array; } public static int[] toIntArray(int... arr) { return arr; } }