How to convert java ArrayList <Double> to equivalent double []
Possible duplicate:
How to distinguish from List <Double> to double [] in Java?
So far, the only way I can work is to loop through the entire array. I was hoping for something like:
ArrayList<Double> myArrayList = ... // initiaize double[] myArray = ... // magic line here +4
2 answers
You cannot go from ArrayList<Double> to double[] with a single call using the sandard Java script. However, check out the ArrayUtils class, available from the Apache site .
On the side of the note, if you need to change your ArrayList to a primitive array, maybe your problem is somewhere else. If you explain in more detail what exactly you are trying to achieve, we could help you better than a simple API hacker.
+2