As I understand it (and as Billy hints), the only performance difference between Vector and ArrayList is that the former is synchronised. So, it can be slower in multithreaded apps, but you might need synchronisation. (Though in that case if you had an ArrayList you could use Collections.synchronizedList(myArrayList) to synchronise it).
In your situation the other concern is the cost of converting a Vector to an ArrayList. Whether or not this is a problem depends on the size of the vector and performance requirements of your app.
The other concern here is which is a better class to use? The general consensus is that (all things being equal) you should use ArrayList, as it's part of the newer Collections framework. Vector is a 'legacy class'.
In your situation, I would stick with the vector if you don't need to pass the object around, or convert it to an ArrayList as soon as you get it, so you don't use the legacy Vector class through your app.
Still, each situation is different
--Tim [ June 28, 2004: Message edited by: Tim West ]
i object to the term 'legacy class'. both Vector and ArrayList internally use an array to store data and both use the same mechanism for growing (native copying of the array to a bigger array). Vector is a Collection just as ArrayList. So the only difference really is the synchronisation. I do agree that every situation requires close look as to what class to use.)
posted 14 years ago
Hmm, looks like I spoke too boldly (read: incorrectly) on this.
I didn't realise that as per the Vector JavaDoc, Vector has been retrofitted into the Collections API - it now implements List.
So, I guess you can ignore that part of my post above. Thanks Sander
Do you object to the term 'legacy class' in general, or just in this instance? It's certainly a term that's in use in the JDK JavaDoc, see here for example.