GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java
Go To First  |  Previous Question  |  Next Question 
 Core Java  |  Question 310 of 492    Print  
What is the difference between ArrayList and Vector otherthan arrayList is not synchronised but Vector is?

  
Total Answers and Comments: 9 Last Update: February 14, 2008     Asked by: diensh 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Rajasekar
 

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



Above answer was rated as good by the following members:
vinaymudgil007
September 25, 2006 15:27:23   #1  
Mayur        

RE: What is the difference between ArrayList and Vecto...

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.


 
Is this answer useful? Yes | No
October 03, 2006 06:14:58   #2  
Amit Rastogi Member Since: October 2006   Contribution: 4    

RE: What is the difference between ArrayList and Vecto...

Vector is fast as compared to Array list

vector grows at a double rate as compared to array list .5 times  


 
Is this answer useful? Yes | No
October 07, 2006 13:40:07   #3  
valanarasu Member Since: September 2006   Contribution: 9    

RE: What is the difference between ArrayList and Vecto...

 In ArrayList we can store only the same data type values. But in Vector we can store the different data type values.


 
Is this answer useful? Yes | No
November 02, 2006 03:12:35   #4  
Kiran        

RE: What is the difference between ArrayList and Vecto...

        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%.  


 
Is this answer useful? Yes | No
November 04, 2006 20:15:50   #5  
faizy        

RE: What is the difference between ArrayList and Vecto...

-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).


 


 
Is this answer useful? Yes | No
November 24, 2006 02:32:26   #6  
Rajasekar        

RE: What is the difference between ArrayList and Vecto...

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


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
May 17, 2007 10:55:56   #7  
Vibs        

RE: What is the difference between ArrayList and Vecto...

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.


 
Is this answer useful? Yes | No
August 10, 2007 07:32:14   #8  
sujatham Member Since: January 2006   Contribution: 142    

RE: What is the difference between ArrayList and Vecto...
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.

 
Is this answer useful? Yes | No
February 14, 2008 23:52:20   #9  
sampra Member Since: February 2008   Contribution: 279    

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

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.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape