43

Possible Duplicate:
Why is Java Vector class considered obsolete or deprecated?

Which type is better to use and how to choice right type (memory usage, execution...)?

Community
  • 1
  • 1
Ballon
  • 6,882
  • 18
  • 49
  • 63

2 Answers2

51

You should normally use ArrayList - it offers better performance.

Vector has just one "advantage" - it is synchronised for concurrent modification. But it turns out in practice that this feature isn't very useful because Vector synchronises at the level of each individual operation. If you are writing concurrent code, you typically need to lock at a much higher level of granularity than an individual collection class.

As a result, Vector is often considered deprecated nowadays.

mikera
  • 105,238
  • 25
  • 256
  • 415
30

As per this question Vector is considered "obsolete", use ArrayList instead.

Community
  • 1
  • 1
Pere Villega
  • 16,429
  • 5
  • 63
  • 100