我想将我的double ArrayList转换为双数组,但我不确定如何。这里是我当前的代码:将双数组列表转换为双数组
ArrayList<Double> aL= new ArrayList<Double>();
double x[] = new double[aL.size()];
aL.add(10.0);
aL.add(5.0);
aL.add(2.0);
for(int i =0; i < x.length; i++){
//some code
}
但后来我不知道去哪里,我无法在互联网上找到的东西/书籍给我任何见解。谢谢。
这个问题显示没有努力。请尝试查阅[列表文档](http://docs.oracle.com/javase/7/docs/api/java/util/List.html)。 – jahroy 2013-03-21 18:33:27
这很简单,你的代码中有你需要的所有东西(循环的内容除外)。你有什么问题? – iamnotmaynard 2013-03-21 18:39:11
有用的链接:http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html http://docs.oracle.com/javase/6/docs/api/java/lang /Double.html http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html – iamnotmaynard 2013-03-21 18:41:06