Here you can find the source of toDoubleArray(List
public static double[] toDoubleArray(List<Double> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static double[] toDoubleArray(List<Double> list) { double[] array = new double[list.size()]; for (int i = 0; i < array.length; i++) array[i] = list.get(i);//from w w w.ja va2 s .c om return array; } public static <T> T get(List<T> l, int i) { return get(l, i, null); } public static <T> T get(List<T> l, int i, T defValue) { if (i < 0) i += l.size(); if (i < 0 || i >= l.size()) return defValue; return l.get(i); } public static <T> T get(T[] l, int i) { return get(l, i, null); } public static <T> T get(T[] l, int i, T defValue) { if (i < 0) i += l.length; if (i < 0 || i >= l.length) return defValue; return l[i]; } public static double get(double[] l, int i, double defValue) { if (i < 0) i += l.length; if (i < 0 || i >= l.length) return defValue; return l[i]; } }