NOTE
List Comparison
Comparison of ArrayList and LinkedList, Vector and ArrayList, and SynchronizedList and Vector.
This is a historical learning note and may contain outdated or incomplete understanding.
1. ArrayList vs LinkedList
| ArrayList | LinkedList | |
|---|---|---|
| Underlying implementation | Array | Doubly linked list |
| Complexity | Fast indexed lookup, slow insertion/deletion | Slow indexed lookup, fast insertion/deletion |
| Whether resizing is required | Initial value is 0; resize when full. The first expansion is to 10, then capacity grows to 1.5 times the original | No |
2. Vector vs ArrayList
| Vector | ArrayList | |
|---|---|---|
| Thread-safe | Yes | No |
| Whether resizing is required | Initial value is 10; resize when full. Capacity grows to twice the original | Initial value is 0; resize when full. The first expansion is to 10, then capacity grows to 1.5 times the original |
3. SynchronizedList vs Vector
| SynchronizedList | Vector | |
|---|---|---|
| Thread-safe | Yes | Yes |
| Synchronization method | synchronized block, using the current list as the lock object. Any list can be converted into a thread-safe one |
synchronized methods, using the current list as the lock object |
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub