Hi All, what is the difference between ArrayList and Vector in terms of performance and its storage. Thanks.
--------------<br />Prashant<br />SCJP-91%
posted 13 years ago
As far as storage is concerned, they are the same since both use a backing Object array. As for performance, all methods of the Vector class are synchronized, those of the ArrayList class are not. The ArrayList implementation is therefore better in terms of execution speed since accessing threads need not get the monitor prior to accessing the collection. The Vector class should not be used anymore since it is possible to get a synchronized ArrayList (when needed) by invoking Collections.synchronizedList().