e martë, 12 qershor 2007

Diff. between ArrayList and Vector.

Vector
------------------------
1) is synchronized, thread-safe.
2) each time a thread is required to acquire a lock before using it.

ArrayList
------------------------
1) is not synchronized or thread-safe.
2) lock is not required by threads.
3) it can be made thread-safe by using Collections.synchronizedList() method.
4) better performance in single-threaded applications. -- no lock is required to acquire.
5) better performance in multi-threaded applications. -- you can implement a synchronize block at more broad level, so at each entry point lock is not required.

Nuk ka komente: