Friday, March 13, 2009

What is the difference between ArrayList and Vector? (JavaUtil)

Question :What is the difference between ArrayList and Vector? (JavaUtil)
Answer :a.Internally, both the ArrayList and Vector hold onto their contents using
an Array. A Vector defaults to doubling the size of its array, while the
ArrayList increases its array size by 50 percent.
b.ArrayList doesn't have a constructor for specifying the incremental
capacity, where as Vector has a constructor to specify the initial capacity
and incremental capacity.
c.Vector is synchronized where as ArrayList is not synchronized

No comments: