Re: setSize ArrayList, when will it come?
On 8/9/2011 11:30 AM, Jan Burse wrote:
Joshua Cranmer schrieb:
There are a fair number of observable differences between Vector and
ArrayList, even if you exclude the part about synchronized methods.
What are you refering to? Can you elaborate on your thoughts.
Anything reflective is a dead giveaway, and I'm pretty sure that the two
classes have slightly different sizes, so you could observe differences
in memory characteristics.
More seriously, the Collections API tweaked some method names
differently, so there are a few methods in Vector which are kept around
for legacy use (addElement, e.g.).
In general, an ArrayList is a list that happens to be backed by an
array. A Vector is a synchronized, automatically-growing array that
leaks details about its array all over the place; it was shoehorned into
the Collections API upon introduction to allow for a more gradual,
correct migration.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth