如何将double数组转换为集合?

时间:2017-07-13 04:11:41

标签: java apache apache-commons apache-commons-math

我有两个数组

   double arr[]=data.attributeToDoubleArray(4);
   double arr0[]=data.attributeToDoubleArray(0);

要计算普通apache中的p值,已记录如下:

 public double anovaPValue(Collection<double[]> categoryData)
               throws NullArgumentException,
                      DimensionMismatchException,
                      ConvergenceException,
                      MaxCountExceededException

       Computes the ANOVA P-value for a collection of double[] arrays.
       Preconditions:

        The categoryData Collection must contain double[] arrays.
        There must be at least two double[] arrays in the categoryData collection and each of these arrays must contain at least two values.

如何在集合中转换我的两个数组,以便我可以使用上面的函数?

1 个答案:

答案 0 :(得分:4)

你可以试试这个:

double arr[]=data.attributeToDoubleArray(4);
double arr0[]=data.attributeToDoubleArray(0);

List<double[]> newArr = Arrays.asList(arr, arr0);