Back to Top

Sunday, 15 January 2012

JAVA : Difference between Vector and ArrayList?

Vector :
  1.               It's synchronized.
  2.               It's slower than ArrayList.
  3.               It's generally used in multithreading programs.

ArrayList :
  1.               It's unsynchronized.
  2.               It's faster than Vector.
  3.               It's generally used in single-thread programs.





12 Responses to “ JAVA : Difference between Vector and ArrayList? ”

chmod examples unix said...
28 March 2012 at 09:38

Good differences, nicely put in point format. another one is that vector was not member of collection framework prior to JDK 1.4 and later retrofitted into Collection API. see here for more differences between Vector and ArrayList


Anonymous said...
15 April 2012 at 04:44

Nicely written


anij said...
15 April 2012 at 08:51

@Anonymous
Thanks a lot my friend!!
thanks for commenting!!


Anonymous said...
27 April 2012 at 00:07

ArrayList does allow null. Stop posting wrong information.


Anonymous said...
8 May 2012 at 10:44

Vector is a part of collection frame work please go the 1.3 documentation of Oracle.


kuldeep said...
10 September 2012 at 03:27

we can specify the increment size with the vector and with arraylist we can't.


Hashtable vs HashMap said...
27 September 2012 at 10:11

One more difference between ArrayList vs Vector is that later is a legacy class and initially not part of Collection API


Anonymous said...
1 July 2014 at 15:20

vector:
It is introduced in java 1.2
It is thread safe
ArrayList:
It is introduced in java 1.5
It is not thread safe


Arunava Saha said...
17 July 2014 at 10:04

One more -
Arraylist is more memory effective than vector because of the difference between their load factor.
Explanation:
Load Factor of Vector is 2 * old_value, means if a vector is sized 10 and it needs to re-size then it will be re-sized to 20 (2 * 10).
whereas load factor of ArrayList is (3 * old_value) / 2 + 1, means if an arraylist is sized 10 and needs to re-size then it will be re-sized to 16 ( (3*10) / 2 + 1 )


Vikas said...
13 June 2015 at 22:11

There is one more option instead of vector, synchronized ArrayList, its better because Vector is too old and can be deprecated.


Naviya Nair said...
24 October 2016 at 15:11

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai

Online Java Training Java 8 Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai Java Training Institutes

Java Training Institutes in Chennai Java Training in Chennai


jazz said...
21 March 2017 at 15:33

Finding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
PHP training in chennai


Post a Comment

Popular Posts

Subscribe via Email
Subscribe Java Interview Questions via Email
All Rights Reserved JAVA INTERVIEW QUESTIONS | Privacy Policy | Anijit Sarkar
blog links Web Directory Academics Blogs