This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes ArrayList & Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply locked New topic
Author

ArrayList & Vector

Amrita Puja
Greenhorn

Joined: Sep 27, 2006
Posts: 10
Hi.

Difference between arraylist and vector is that, arraylist is synchronized where as vector is synchronized, in arraylist when the data added increases array size will increase, but in vector when initial size should be specified, if we add more data to it, it will double the size giving more allocations.

According to my knowledge, these are the diffrences i know.

Please tell me these differences are correct or not. If more differences are there, post those answers.

If arraylist is not synchronized, how we can do it synchronized.

If already list is there, what is the need of arraylist.

Thankyou.
Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 413
    
    2

RE : If arraylist is not synchronized, how we can do it synchronized.

Use the apporpiate synchronized collection decorator

i.e. static method synchronizedList in the Collections class


"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18553
    
  40

Please do not crosspost. It wastes people's time and effort, as we can't tell if a question has already been answered.

Anyway, since the beginner forum is more appropriate, I am closing this topic.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ArrayList & Vector
 
Similar Threads
ArrayList vs Vector
Differences between vector and arraylist
ArrayList & Vector
what is the use of different collections..
what is the difference between arrays,vector and Array List?