Forums Register Login

default size of vector and arraylist

+Pie Number of slices to send: Send
I know the basic difference that vector is synchronised and arraylist is not.There is some difference in the default size and the way it expand itself when it becomes full.can someone help me understand the same
+Pie Number of slices to send: Send
They do use a different algorithm for growing the array. Vector uses the classic multiply-by-two algorithm -- every time the array grows, it doubles in size. From a theoretical standpoint, this has near-optimal performance -- but it uses too much memory. I believe ArrayList uses a more moderate grow-by-50% rule; the performance in real applications is basically the same, and it uses less memory.
+Pie Number of slices to send: Send
Thanks for the update.wot is the size when it is initially created using their default constructor
+Pie Number of slices to send: Send
According to the source it is 10 in both cases.
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2053 times.
Similar Threads
Question in Collection?
ArrayList vs Vector
What is difference between ArrayList and vector?
Difference between ArrayList and Vector
Difference between ArrayList and Vector
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:17:41.