I need to convert a nested list of Double to a double[][]. I have tried using the code below, but the issue is how to convert to the primitive double. Any help would be much appreciated.
double[][] matrix = new double[listReturns.size()][];
int i = 0;
for (List<Double> nestedList : listReturns) {
matrix[i++] = nestedList.toArray(new Double[nestedList.size()]);
}