Here you can find the source of toIntArray(List list)
Parameter | Description |
---|---|
list | a List of Integers. |
public static int[] toIntArray(List list)
//package com.java2s; /*/* w ww . ja v a2 s . c o m*/ * Copyright (c) 2007-2008 Matthew Hall and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Matthew Hall - initial API and implementation */ import java.util.List; public class Main { /** * Converts the argument to an int[] array. * * @param list * a List of Integers. * @return a primitive int[] array. */ public static int[] toIntArray(List list) { final int[] array = new int[list.size()]; for (int i = 0; i < array.length; i++) array[i] = ((Integer) list.get(i)).intValue(); return array; } }