Java List to Array listToArray(final List list)

Here you can find the source of listToArray(final List list)

Description

List to array.

License

GNU General Public License

Parameter

Parameter Description
list the list

Return

the double[]

Declaration

public static double[] listToArray(final List<? extends Number> list) 

Method Source Code

//package com.java2s;
/*/*from w ww .  j  a  v  a  2 s  .c  o m*/
 * Title:        CloudSim Toolkit
 * Description:  CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
 * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html
 *
 * Copyright (c) 2009-2012, The University of Melbourne, Australia
 */

import java.util.List;

public class Main {
    /**
     * List to array.
     * 
     * @param list the list
     * @return the double[]
     */
    public static double[] listToArray(final List<? extends Number> list) {
        double[] array = new double[list.size()];
        for (int i = 0; i < array.length; i++) {
            array[i] = list.get(i).doubleValue();
        }
        return array;
    }
}

Related

  1. convertStringListToArray(List list)
  2. convertStringListToArray(List list)
  3. convertToArray(final List> list)
  4. convertToArray(List list)
  5. convertToArray(List args)
  6. listToArray(final List a)
  7. listToArray(List data)
  8. listToArray(List ids)
  9. listToArray(List list)