Java List to Double Array toDoubleArray(List list)

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

Description

to Double Array

License

Apache License

Declaration

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

Method Source Code

//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];
    }
}

Related

  1. toDoubleArray(final List numbers)
  2. toDoubleArray(final List list)
  3. toDoubleArray(List a)
  4. toDoubleArray(List list)
  5. toDoubleArray(List list)
  6. toDoubleArray(List list)
  7. toDoubleArray(List list)