The difference between ArrayList and Vector

The difference between ArrayList and Vector
1. synchronization and thread-safe
   Vector is  synchronized while ArrayList is not synchronized.
2. performance
   Vector is slow as it is thread safe . In comparison ArrayList is fast as it is non synchronized.
3. Capacity automatic increase
   A Vector defaults to doubling size of its array. While when insert an element into the ArrayList, it increases its Array size by 50%. By default ArrayList size is 10.
4. increment size
   ArrayList does not define the increment size . Vector defines the increment size.
5. Enumerator
   Other than Hashtable, Vector is the only other class which uses both Enumeration and Iterator. While ArrayList can only use Iterator for traversing an ArrayList.

orm

相關文章
相關標籤/搜索