Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

array of array doubt

 
akila sekaran
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Whats wrong in this ?
How do i add values to list of list of strings??
 
Joel Christophel
Ranch Hand
Posts: 250
1
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
List<IBean> list = listB.get(j)

How can 'list', which is a List, be equal to the value of a list index?
 
akila sekaran
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joel Christophel wrote:List<IBean> list = listB.get(j)

How can 'list', which is a List, be equal to the value of a list index?


ListB is a List<List<IBean>>
 
Tony Docherty
Bartender
Posts: 2969
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i add values to list of list of strings??

You get a reference to the list of strings from the list of list of strings (eg by calling it's get() method) and then call it's add() method passing in the String you want to add.
Do you have a list of list of strings in the code shown?

BTW line 6 is overly complicated by you trying to do way too much on one line. I suggest you break into at least 3 lines, it will make your code easier to read and less prone to bugs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic