Collections.synchronizedList vs Vector

10,393

Here are few words on why Vector is an obsolete/deprecated class: Why is Java Vector class considered obsolete or deprecated?

Generally about their difference: In java, Vector and Collections.synchronizedList are all synchronized, what's the difference?

Share:
10,393

Related videos on Youtube

Murali
Author by

Murali

Updated on July 12, 2022

Comments

  • Murali
    Murali almost 2 years

    I would like to use collection classes for adding,removing and retrieving objects in multiple thread.

    Collections.synchronizedList and Vector both classes are thread safe. Does any tell me the difference between Collections.synchronizedList and Vector and explain that when should I use Vector and Collections.synchronizedList?

  • Vishy
    Vishy over 10 years
    +1 Use Vector when you have to because you are using an old API which expects it. Otherwise use List.