Here you can find the source of toArray(final List
Parameter | Description |
---|---|
list | a parameter |
public static double[] toArray(final List<Double> list)
//package com.java2s; /*//from w w w .ja va 2 s . c o m * JCAT - TAC Market Design Competition Platform * Copyright (C) 2006-2010 Jinzhong Niu, Kai Cai * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. */ import java.util.List; public class Main { /** * * @param list * @return an array of double values from the given list in the original * order; */ public static double[] toArray(final List<Double> list) { final double array[] = new double[list.size()]; for (int i = 0; i < array.length; i++) { array[i] = list.get(i).doubleValue(); } return array; } }