Here you can find the source of toIntArray(final Collection extends Number> c)
Parameter | Description |
---|---|
c | a parameter |
public static int[] toIntArray(final Collection<? extends Number> c)
//package com.java2s; import java.util.*; public class Main { /**//from w w w .j ava 2 s.c om * @param c * @return */ public static int[] toIntArray(final Collection<? extends Number> c) { if (c == null) { return null; } final int[] r = new int[c.size()]; int i = 0; for (final Number n : c) { r[i++] = n.intValue(); } return r; } public static int size(Collection<?> c) { return (c == null) ? 0 : c.size(); } }