Java List to Double Array toDoubleArray(List list)

Here you can find the source of toDoubleArray(List list)

Description

This converts a list to it's primitive state.

License

Open Source License

Parameter

Parameter Description
list The list to convert

Return

The primitive array instance of the list's contents.

Declaration

public static double[] toDoubleArray(List<Double> list) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    /**//from w  w w .  j av a 2  s. c om
     * This converts a list to it's primitive state.
     * In this case, it converts a {@link Double} list to a
     * double array.
     * 
     * @param list The list to convert
     * @return The primitive array instance of the list's contents.
     */
    public static double[] toDoubleArray(List<Double> list) {
        double[] array = new double[list.size()];
        for (int i = 0; i < list.size(); i++) {
            array[i] = list.get(i);
        }
        return array;
    }

    public static double[] toDoubleArray(double... arr) {
        return arr;
    }
}

Related

  1. toDoubleArray(List a)
  2. toDoubleArray(List list)
  3. toDoubleArray(List list)
  4. toDoubleArray(List list)
  5. toDoubleArray(List list)
  6. toDoubleArray(List list)
  7. toDoubleArray(List values)
  8. toDoubleArray(List stringArray)
  9. toDoubleArray(List values)