Vector, ArrayList, LinkedList difference

Original please indicate the source: https://www.cnblogs.com/agilestyle/p/11443907.html

 

Vector

Vector is thread-safe Java dynamic arrays provide early, if not thread-safe, is not recommended to choose, after all, there is a synchronization overhead. Internal Vector is using an array of objects to hold the data, it can automatically add capacity as needed, when the array is full, it will create a new array and copy the original array data.

 

ArrayList

ArrayList is more widely implementation of dynamic arrays, which itself is not thread safe, so the performance is much better. Vector and similar, capacity can be adjusted ArrayList is needed, but the two differ adjustment logic, Vector upon expansion will be increased by 1, ArrayList is 50%.

 

LinkedList

Java provides LinkedList is doubly linked list, so that it does not like the above two adjustment capacity, it is not thread-safe.

 

Guess you like

Origin www.cnblogs.com/agilestyle/p/11443907.html