【发布时间】:2014-06-26 11:01:27
【问题描述】:
有没有捷径可以很好地做到这一点?
那丑陋的两个循环(一个循环读取 pmList 和第二个循环添加到 markupArray)是唯一的选择(而不是 ArrayUtils)。
ArrayList<Double> pmList = new ArrayList<Double>();
pmList.add(0.1); // adding through a loop in real time.
pmList.add(0.1);
pmList.add(0.1);
pmList.add(0.1);
double[] markupArray = new double[pmList.size()];
arkupArray = pmList.toArray(markupArray); // This says The method toArray(T[]) in the type ArrayList<Double> is not applicable for the arguments (double[])
【问题讨论】:
标签: java arrays collections