Java Utililty Methods List to Double Array

List of utility methods to do List to Double Array

Description

The list of methods to do List to Double Array are organized into topic(s).

Method

double[]toDoubleArray(List stringArray)
to Double Array
if (stringArray == null) {
    return null;
double[] result = new double[stringArray.size()];
for (int i = 0; i < stringArray.size(); i++) {
    try {
        if (stringArray.get(i) != null) {
            result[i] = Double.parseDouble(stringArray.get(i));
...
double[]toDoubleArray(List values)
to Double Array
double[] ds = new double[values.size()];
for (int i = 0; i < ds.length; i++) {
    ds[i] = Double.parseDouble(values.get(i));
return ds;
ListtoDoubleList(double[] array)
to Double List
List<Double> result = new ArrayList<Double>(array.length);
for (int i = 0; i < array.length; i++) {
    result.add(i, array[i]);
return result;
ListtoDoubleList(double[] array)
to Double List
List<Double> list = new ArrayList<Double>(array.length);
for (double el : array)
    list.add(el);
return list;
ListtoDoubleList(double[] doubleArray)
Convert the given double array to a double list
List<Double> doubleList = new ArrayList<Double>(doubleArray.length);
for (double currDouble : doubleArray) {
    doubleList.add(currDouble);
return doubleList;
ListtoDoubleList(Double[] in)
to Double List
List<Double> ret = new ArrayList<Double>();
for (Double d : in)
    ret.add(d);
return ret;
ListtoDoubleList(final E[] array)
to Double List
List<Double> doubleList = null;
if (array != null) {
    doubleList = new ArrayList<Double>(array.length);
    for (E e : array) {
        if (e != null) {
            try {
                doubleList.add(Double.parseDouble(e.toString()));
            } catch (NumberFormatException nfe) {
...
ListtoDoubleList(List values)
to Double List
return values;
ListtoDoubleList(List list)
Converts a list of integers to a list of doubles.
List<Double> doubleList = new ArrayList<Double>();
for (Integer val : list) {
    doubleList.add(val.doubleValue());
return doubleList;
ListtoDoubleList(String[] array)
Converts a String array to a double array.
List<Double> out = new ArrayList<Double>(array.length);
for (int i = 0; i < array.length; i++) {
    if (array[i] == null)
        throw new RuntimeException("Null value in position " + i);
    out.add(Double.parseDouble(array[i]));
return out;