Thursday, August 21, 2008

Difference between Arraylist Vs Vector

Arraylist Vs Vector


  • Vector is synchronous but arraylist is asynchronous.
  • Vector & Hashtables are introduced in JDK1.0 but Araaylist & HashMaps are introduced in JDK1.2.
  • vector is comparatively slow with Arrraylist.

When to use what?

  • If your data is accessed by multiple threads then go for Vector.
  • If your list is a local variable then go for Arraylist blindly.
  • If your data is accessed by a single thread then go for Arraylist.

No comments: