Sunday, 15 January 2012
JAVA : Difference between Vector and ArrayList?
Do you like this Article?
Vector :
ArrayList :
- It's synchronized.
- It's slower than ArrayList.
- It's generally used in multithreading programs.
ArrayList :
- It's unsynchronized.
- It's faster than Vector.
- It's generally used in single-thread programs.
Subscribe to:
Post Comments
(
Atom
)
Popular Posts
-
public - public means everyone can access it.That means it's in global scope. As, main method is called by JVM [ Java Virtual Machine...
-
throw is used to throw an exception in a program, explicitly . Whereas, throws is included in the method's declaration part, wi...
-
Vector : It's synchronized. It's slower than ArrayList. It's generally used in ...
-
doGet(): protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, java.io.IOException – is a met...
-
Web Container / Servlet Container / Servlet Engine : In J2EE Architecture , a web container (also known as servlet container or ser...
-
Life cycle of a servlet starts when its first load in the memory space in web server and ends when unloaded from the server memory. w...
-
Singleton in one of the most popular yet controversial design pattern, in the world of object oriented programming. It's one of t...
-
Program compiles. But at runtime throws an error “NoSuchMethodError”.

12 Responses to “ JAVA : Difference between Vector and ArrayList? ”
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
15 April 2012 at 04:44
Nicely written
15 April 2012 at 08:51
@Anonymous
Thanks a lot my friend!!
thanks for commenting!!
27 April 2012 at 00:07
ArrayList does allow null. Stop posting wrong information.
8 May 2012 at 10:44
Vector is a part of collection frame work please go the 1.3 documentation of Oracle.
10 September 2012 at 03:27
we can specify the increment size with the vector and with arraylist we can't.
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
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
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 )
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.
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
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