• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding list element to Object array  RSS feed

 
Rodricks george
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!