How do I convert Double[] to double[]?

后端 未结 8 1756
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 09:04

I\'m implementing an interface that has functionality similar to a table that can contain an types of objects. The interface specifies the following function:



        
8条回答
  •  爱一瞬间的悲伤
    2020-11-28 09:27

    You could use a for each loop to construct a temp array of the same size then cast each individual element to double and but it in the array.

    SO:

    double[] tempArray = new double[data[columnIndex].length];
    int i = 0;
    for(Double d : (Double) data[columnIndex]) {
      tempArray[i] = (double) d;
      i++;
    }
    

    Please correct me if I am dead wrong here.

提交回复
热议问题