Possible Duplicate:
convert String arraylist to string array in java?
Following is my code
ArrayList<String> IdList = new ArrayList<String>();
and I want to copy items from
IDList
to int IdArray[]
.
We started with Q&A. Technical documentation is next, and we need your help.
Whether you're a beginner or an experienced developer, you can contribute.
Following is my code
and I want to copy items from
|
|||||||||||||||||
marked as duplicate by aioobe, Reno, Pops♦, Octavian Damiean, Graviton Oct 19 '11 at 2:51This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. |
|||||||||||||||||
|
Try this stuff,
|
|||||||||||||||||
|
String [] outStrArray = (String [])IdList.toArray() |
|||||
|
However, this will probably fail because you're trying to convert a string-arraylist to an int-array.. |
|||
|
I think you must iterate through all items, which are Strings, and parse each of them into an int to populate your new int[] array. |
|||||
|
|
|||
|
|
|||
|