Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to add 2 list object to a 3rd list obj.

 
amarshi mohanty
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All ,
I have


i need to put these to a 3rd list object (oderwise append "a" at the end of "b").
please share me any idea on this

thanks
amarshi

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the API for the java.util.List class. You'll find the methods you need there.
 
amarshi mohanty
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i got


List b = new ArrayList(a);

thanks chris
 
Istvan Kovacs
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's also a method that adds all members of a collection to another...


This just creates a new ArrayList b that contains the same values as a. But you can also have:



 
Kamlesh Kumar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Message deleted. Apologies for the posting direct answer.
Will take care henceforth.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50277
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not convinced. Giving a straight answer like that, Kamlesh Kumar, doesn't help anybody learn or do their work. If somebody posts a question and is directed to the API documentation for List<E>, he should be able to read what its 25 methods are and work out which to use. Or at least ask "Should I use xxx() or yyy()?"

I have pulled rank and taken the liberty of deleting the answer. I hope you don't mind, Rob Robert and Jesper.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic