Results 1 to 4 of 4
- 07-31-2012, 10:59 AM #1
Member
- Join Date
- Apr 2012
- Posts
- 3
- Rep Power
- 0
What is the use of Vector where as Arraylist can be Synchronized?
Hi All,
it may silly question but any how need to know more details.
The difference between Vector and ArrayList is thread safe whereas Arraylist is not. but as the arraylist can be make synchronized what is the necessity of Vector?
also
Enumeration and Iterator?
thanks in advance.
- 07-31-2012, 12:26 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: What is the use of Vector where as Arraylist can be Synchronized?
Vector is a legacy class from pre-1.2 (along with Hashtable).
1.2 saw the introduction of the Collections framework.
Same for Enumeration.Please do not ask for code as refusal often offends.
- 07-31-2012, 12:45 PM #3
Member
- Join Date
- Apr 2012
- Posts
- 3
- Rep Power
- 0
Re: What is the use of Vector where as Arraylist can be Synchronized?
Fine, one more question releated to this, how to check whether the current ArrayList object is synchronized or not?
- 07-31-2012, 01:02 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: What is the use of Vector where as Arraylist can be Synchronized?
That's easy.
An ArrayList is not synchronised.
You can get a List that is synchronised based on an ArrayList using Collections.synchronizedList(), but the ArrayList itself won't be synchronised.Please do not ask for code as refusal often offends.
Similar Threads
-
Difference between Vector and Arraylist
By Lil_Aziz1 in forum New To JavaReplies: 10Last Post: 09-04-2012, 09:18 PM -
Synchronized ArrayList
By java4amanda in forum New To JavaReplies: 1Last Post: 05-08-2012, 11:56 AM -
ArrayList copy some of the element from one arraylist tnto another arraylist
By ralf in forum New To JavaReplies: 12Last Post: 07-07-2011, 08:49 PM -
Vector<vector> loop thru
By ocean in forum New To JavaReplies: 11Last Post: 11-21-2009, 02:17 PM -
Difference between Arraylist and Vector in abstractTableModel ?
By riddhik84 in forum New To JavaReplies: 3Last Post: 11-07-2009, 05:25 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks