Difference between array list and vector?


Array list
  • Array list is collection class. Which is implementing marker interface like cloneable, serializable and random access
  • Objects of array list are not synchronized by default, i.e. multiple threads can access array list objects concurrently
  • You can access array list elements using Iterator.
Vector
  • Vector is a legacy class which is also implementing same three interface.
  • Vector class object are synchronized by default i.e. only one thread can access vector class object at a time .Remaining threads as to wait until thread usage is completed.
  • You can access vector elements using Iterator or Enumeration.

0 comments :

Post a Comment