Here you can find the source of toIntArray(final Collection
Parameter | Description |
---|---|
col | collection to convert |
public static int[] toIntArray(final Collection<Integer> col)
//package com.java2s; /*//from www. ja va 2 s. c o m * Nividic development code * * This code may be freely distributed and modified under the * terms of the GNU Lesser General Public Licence. This should * be distributed with the code. If you do not have a copy, * see: * * http://www.gnu.org/copyleft/lesser.html * * Copyright for this code is held jointly by the microarray platform * of the ?cole Normale Sup?rieure and the individual authors. * These should be listed in @author doc comments. * * For more information on the Nividic project and its aims, * or to join the Nividic mailing list, visit the home page * at: * * http://www.transcriptome.ens.fr/nividic * */ import java.util.Collection; public class Main { /** * Convert a collection of int to an array of ints. * @param col collection to convert * @return a new array of ints */ public static int[] toIntArray(final Collection<Integer> col) { if (col == null) return null; final int[] result = new int[col.size()]; int i = 0; for (Integer val : col) result[i++] = val; return result; } }