Here you can find the source of toArray(Collection
Parameter | Description |
---|---|
values | a parameter |
public static double[] toArray(Collection<Double> values)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /**//from w w w. j a v a 2 s . c o m * Returns an array representation * @param values * @return */ public static double[] toArray(Collection<Double> values) { double[] result = new double[values.size()]; int i = 0; for (Double value : values) { result[i] = value; i++; } return result; } }