Error talking about Vector and multi-threaded app

Hi, Great course! Thanks!

The Ultimate Data Structures & Algorithms: Part 1

9- Dynamic Arrays

“if you have a multi-threaded application where multiple threads are going to work with this collection then you’re not going to be able to use the Vector class”

This is wrong.

The Vector class is thread-safe. The ArrayList is not.

The Vector class synchronizes every method which is too heavy-handed and kills
performance. The ArrayList performs better.

Typically in a multithreaded application you would use the ArrayList as a private member variable in a class, limit access to it to only what is needed, and synchronize only what is needed. (Or ensure that it is only accessed by a single thread in the design of the application.)

I thought he said the opposite (ie. that you should use a Vector for multi threaded) but I may have just misheard. Either way, what you said is correct. I have never used Vector in my career and would synchronize access to ArrayList as needed if I wanted multi threading access.