What is the difference between ArrayList and Vector otherthan arrayList is not synchronised but Vector is?

Showing Answers 1 - 5 of 5 Answers

Mayur

  • Sep 25th, 2006
 

It is similar to ArrayList, but with two differences: Vector is synchronized, and it contains many legacy methods that are not part of the collections framework.

  Was this answer useful?  Yes

Kiran

  • Nov 2nd, 2006
 

        In Vector, there is a constructor for specifing  initial capacity and incremental capacity. Where as in ArrayList there no constructor for specifing incremental capacity.

      Vector, it defaults to doubling the size of an array.  In ArrayList, it icreases its array size by 50%.  

  Was this answer useful?  Yes

faizy

  • Nov 4th, 2006
 

-Arraylist has no default size while vector has a default size of 10.
-Arraylist don't define any increment size while vector does.
-arraylist can be seen directly without any iterator while vector requires an iterator to display all it's content. (not very sure).


 

  Was this answer useful?  Yes

Rajasekar

  • Nov 24th, 2006
 

Array List

Unsynchronized, not thread safe

No default size

Increase by 50% of its size

array list doesn?t need iterator to display it contents

         Array list doesn?t defines any increment    size

Vector

Synchronized , thread safe

Default size 10

Doubling the size of array

Needs iterator to display its content

          Vector does

Vibs

  • May 17th, 2007
 

Request tll all those who post reply..please only post replies if u know correct..or if u r not sure..alteast mention not sure...why to say something wrong that creates problem for others..this is very good site...pls let us maintain it correctness...


Vector and Arraylist both has initial capacity and it is 10

Vector is synchronized and Arraylist is not

Vector has option to set incremental capacity Arraylist does not have.

There is a difference b/w thw way both grows but I am not sure exactly what is the difference in terms of growth rate.

  Was this answer useful?  Yes

1. In vector the data is retrieved using the elementAt() method
2. In ArrayList, it is done using the get() method.
3. ArrayList has no default size while vector has a default size of 10.?
4. 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.

  Was this answer useful?  Yes

sampra

  • Feb 14th, 2008
 

It is similar to ArrayList, but with two differences: Vector is synchronized, and it contains many legacy methods that are not part of the collections framework.

  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