The moose likes Beginning Java and the fly likes cloning array of vectors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cloning array of vectors" Watch "cloning array of vectors" New topic

cloning array of vectors

Dalibor Toth
Ranch Hand

Joined: Jul 16, 2001
Posts: 38
How do I clone array of vectors?
This works only for one vector:
Vector vector2 = (Vector)vector.clone();
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
You could create a vector of vectors instead of and array of vectors, first of all. Or better yet, a list of lists. You could also just make a boring loop:
Vector[] copy = new Vector[old.length];
for (int i = 0; i < old.length; old++) {
copy[i] = old[i].clone();
Dalibor Toth
Ranch Hand

Joined: Jul 16, 2001
Posts: 38
Sorry, maybe I wasn't too clear:
I have vector v that contains 3 vectors and I need to clone it.
I agree. Here's the link: http://aspose.com/file-tools
subject: cloning array of vectors
Similar Threads
creating names for vectors
two dimensional array into vector
Model for JTable
Implementing MultiDimensional Vectors
can you have an array of vectors