The ArrayList class is the one that replaces the vector class when the Java collection framework appears.
The underlying principle is an array-based algorithm, identical.
Difference:
Vector: All methods use the Synchronize modifier thread-safe but low performance for multithreaded environments.
ArrayList: All methods do not use the Synchronize modifier thread is unsafe but has high performance.
Do not use the vector class even after multithreading
because: List List = Collections.synchronizedlist (new ArrayList (...));
Common methods refer to vector classes
Read the source code found that the vector class and the ArrayList class difference is a bit large ( from the set to consider )
Sometimes a method needs to return a ArrayList object
But in this method, if none of the queries are returned to NULL, we return an empty collection object (no collection of elements)
Before Java7, even though an object was created with new ArrayList, one element was not stored, but the object array of length 10 was still initialized in the heap space, wasting heap space.
To optimize this design from JAVA7, new ArrayList actually creates an empty array that will be reinitialized when Add.
Java Core Class Library-collection Framework-arraylist class