This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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.
Hi As you said, the differences you have given about Arraylist and Vector are perfect. Now about you queries If arraylist is not synchronized, how we can do it synchronized.?
If you want to make arraylist synchronized, you should use Collections.synchronizedCollection(Collection c) method or you can use Collections.synchronizedList(List list) method in the Collections class.
If already list is there, what is the need of arraylist? Amrita, check the API[java.util]. List is an interface which sets the rule where as Arraylist implements the List interface.
Vector came first. It was already introduced into Java in version v1.2. Due to this, Vector still has the old method names like addElement. This method identifier (and the like) is/are not found in ArrayList.
p.m., hey, Makarandp, do you know, your member number is a prime?
all events occur in real time
Joined: Sep 26, 2006
Hi Burkhard Hassel "hey, Makarandp, do you know, your member number is a prime?" - i didn't get what you want to say. Can you come back please.