views:

71

answers:

1

Is there any way to copy or convert a vector to arraylist in Java?

+12  A: 

Yup - just use the constructor which takes a collection as its parameter:

Vector<String> vector = new Vector<String>();
// (... Populate vector here...)
ArrayList<String> list = new ArrayList<String>(vector);

Note that it only does a shallow copy.

Jon Skeet