lejahmie
lejahmie

Reputation: 18253

What does synchronized mean in context of Vector / ArrayList?

I've just read up some information on Vector and ArrayList. From what I can understand Vector is obsolete compared to ArrayList. But Vector is synchronized whilst ArrayList is not.

But what does that mean? What does it mean when we say that a Vector is synchronized? And when is this useful?

Upvotes: 12

Views: 7607

Answers (1)

Taymon
Taymon

Reputation: 25676

It means that multiple threads can modify the Vector in parallel without risk of data corruption.

If you want to do this with an ArrayList, you need to use the synchronized keyword.

Upvotes: 22

Related Questions