jose chiramal wrote:1. Arraylist is not synchronized while vector is. (Correct)
2. Arraylist has no default size while vector has a default size of 10. (Is this correct , I have a doubt)
3. Arraylist don't define any increment size while vector does. (Correct)
4. Arraylist can be seen directly without any iterator while vector requires an iterator to display all it's content. (not very sure).
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Good luck!!
A small leak can sink a Gigantic ship.>
Wake up! Don't let your smile be snatched away by anybody!
Regards, Eswar
Eswara Moorthy Nec wrote:ArrayList has no default size.
Vector has a default size of 10.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:
Eswara Moorthy Nec wrote:ArrayList has no default size.
Vector has a default size of 10.
Wake up! Don't let your smile be snatched away by anybody!
Regards, Eswar
Rob Prime wrote:
NonsenseThe size is the number of elements stored inside the List, the capacity is the size of the backing array. Both have a default size of 0 and a default capacity of 10. Both are clearly specified in the API, as "empty list" / "empty vector" indicates a size of 0.
Wake up! Don't let your smile be snatched away by anybody!
Regards, Eswar
Eswara Moorthy Nec wrote:You are not author of java language .Don't use the wrong word...
This is public forum. Not your own.
You just mention 'this is wrong answer' or 'This is right answer'. thats all.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:If you feel offended by my use of the word nonsense then I apologize. It's just a word I use in daily life when someone is wrong.
Eswara Moorthy Nec wrote:One more Difference:
The ArrayList increases its array size by 50 percent.
A Vector defaults to doubling the size of its array.
And the API documentation for Vector says:The details of the growth policy are not specified beyond the fact that adding an element has constant amortized time cost.
Of course, particular implementations may work in particular ways, and what you say may be true of one Java implementation. Other Java implementations may work differently.as components are added to the vector, the vector's storage increases in chunks the size of capacityIncrement.
Paul Clapham wrote:...And the API documentation for Vector says:
as components are added to the vector, the vector's storage increases in chunks the size of capacityIncrement.
If the capacity increment is less than or equal to zero, the capacity of the vector is doubled each time it needs to grow.
Wake up! Don't let your smile be snatched away by anybody!
Regards, Eswar
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|