Difference between Vector and ArrayList?

This question is related to Oracle Interview

Showing Answers 1 - 4 of 4 Answers

Lavanya

  • Apr 14th, 2005
 

Vector can be synchronized and array list is not.

  Was this answer useful?  Yes

varsha

  • Jun 13th, 2005
 

as vector is synchronized class so execution wil be slower then arraylist,but that will be thread safe.arraylist execution fast but not thread safe.

  Was this answer useful?  Yes

sun

  • Oct 4th, 2005
 

as vector is synchronized class so execution wil be slower then arraylist,but that will be thread safe.arraylist execution fast but not thread safe.

  Was this answer useful?  Yes

pyasodha

  • Sep 8th, 2010
 

1) Synchronization - ArrayList is not thread-safe whereas Vector is thread-safe. In Vector class each method like add(), get(int i) is surrounded with a synchronized block and thus making Vector class thread-safe. 

2) Data growth - Internally, both the ArrayList and Vector hold onto their contents using an Array. When an element is inserted into an ArrayList or a Vector, the object will need to expand its internal array if it runs out of room. A Vector defaults to doubling the size of its array, while the ArrayList increases its array size by 50 percent. 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions