File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes how to add 2 list object to a 3rd list obj. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to add 2 list object to a 3rd list obj." Watch "how to add 2 list object to a 3rd list obj." New topic
Author

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

amarshi mohanty
Ranch Hand

Joined: Jul 01, 2008
Posts: 110
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



SCJP (97%), SCWCD (95%))
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Check the API for the java.util.List class. You'll find the methods you need there.


[My Blog]
All roads lead to JavaRanch
amarshi mohanty
Ranch Hand

Joined: Jul 01, 2008
Posts: 110
ok i got


List b = new ArrayList(a);

thanks chris
Istvan Kovacs
Ranch Hand

Joined: May 06, 2010
Posts: 100
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

Joined: Apr 17, 2006
Posts: 8
Message deleted. Apologies for the posting direct answer.
Will take care henceforth.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36520
    
  16
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to add 2 list object to a 3rd list obj.
 
Similar Threads
removeAll() meathod, a confirm required!
List with a sublist of Integers
Why are Generics necessary here?
splitting up lists
How to subtract two arrayLists?