| Author |
Adding list element to Object array
|
Rodricks george
Ranch Hand
Joined: Sep 10, 2006
Posts: 97
|
|
Dear Sir, I have a Object array and i want to add data inside, rite now i am adding two list inside setToList (it is a araylist) subFileList2 (it is a araylist) Object[][] data = { {setToList, subFileList2} }; the problem is i want to add all element of List to the data array. for example Object[][] data = { {setToList.get(0), subFileList2.get(0)} }; how can i achieve this. -Thanks with regs, Rodricks
|
 |
bart zagers
Ranch Hand
Joined: Feb 05, 2003
Posts: 234
|
|
I do not understand what exactly you are trying to accomplish. Do you want "data" to be an array with 2 elements. The first one an array containing the elements of the first list and the second one containing the elements of the second list? If so you need to do something like the following: To convert the lists to an array, take a look at the toArray method of List.
|
 |
Rodricks george
Ranch Hand
Joined: Sep 10, 2006
Posts: 97
|
|
Sir, Yes...The first one an array containing the elements of the first list and the second one containing the elements of the second list Object[][] data = { {elements of the first list,elements of the second list} }; thanks with regs, Rodricks
|
 |
bart zagers
Ranch Hand
Joined: Feb 05, 2003
Posts: 234
|
|
Well, you can not do this in one go. You will have to do something like: As I said, to convert the list to an array, there is a toArray method in List.
|
 |
 |
|
|
subject: Adding list element to Object array
|
|
|