File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Appending Vectors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Appending Vectors" Watch "Appending Vectors" New topic
Author

Appending Vectors

Stephen Murphy
Greenhorn

Joined: Feb 26, 2004
Posts: 24
Is there a way to append one vector to the end of another? I was hoping there was a method already in java to do this. Otherwise I'll have to write one myself.

Thanks,
Stephen
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
Have you examined the addAll() method?


Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Stephen Murphy
Greenhorn

Joined: Feb 26, 2004
Posts: 24
That was so amazingly obvious. Don't know how I missed a method that adds a collection.

Thanks.
sven studde
Ranch Hand

Joined: Sep 26, 2006
Posts: 148
>Is there a way to append one vector to the end of another?

Why are you using a Vector? You most likely should be using an ArrayList, which is just like an array, but it can grow in size. Vector = oldschool, ArrayList = newschool.
[ November 05, 2006: Message edited by: sven studde ]
Sudhakar Reddy Kurakula
Ranch Hand

Joined: Aug 19, 2006
Posts: 42
Hi
This is the code.

Vector v1=new Vector();
//add elements.
Vector v2=new Vector();
v1.add(v2);
//now this appends at the end of the last element.

Cheers
Sudhakar Reddy
M.C.A(2006)
Satyam.
9989223696
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Appending Vectors