Java Array Convert to toDoubleArray(Double[] list)

Here you can find the source of toDoubleArray(Double[] list)

Description

to Double Array

License

Open Source License

Declaration

public static double[] toDoubleArray(Double[] list) 

Method Source Code

//package com.java2s;
/* ***** BEGIN LICENSE BLOCK *****
 *
 * This file is part of Weave.//from ww  w. jav  a  2  s.  co m
 *
 * The Initial Developer of Weave is the Institute for Visualization
 * and Perception Research at the University of Massachusetts Lowell.
 * Portions created by the Initial Developer are Copyright (C) 2008-2015
 * the Initial Developer. All Rights Reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 * 
 * ***** END LICENSE BLOCK ***** */

import java.util.Collection;

public class Main {
    public static double[] toDoubleArray(Double[] list) {
        double[] array = new double[list.length];
        for (int i = 0; i < array.length; i++)
            array[i] = list[i];
        return array;
    }

    public static double[] toDoubleArray(Collection<Double> list) {
        double[] array = new double[list.size()];
        int i = 0;
        for (double value : list)
            array[i++] = value;
        return array;
    }
}

Related

  1. convertArrayToLine(String[] cols)
  2. convertArrayType(String type)
  3. convertArrayTypeName(final String typeName)
  4. convertArrayValue(Object value, Class type)
  5. toDoubleArray(byte[] data)
  6. toDoubleArray(final int[] intArray)
  7. toFloatArray(final double[] doubles)
  8. toInt(Integer[] arr)
  9. toIntArray(double[] a)