Detailed explanation of dynamic expansion of Arraylist
ArrayList Overview ArrayList is implemented based on arrays, is a dynamic array, and its capacity can grow automatically. ArrayList is not thread safe and can only be used in a single-threaded environment. The Serializable interface is implemented, so it supports serialization and can be transmitted through serialization; the RandomAccess interface is implemented, which supports fast random access, which is actually fast access through the subscript sequence number; and the Cloneable interface is implemented, which can be cloned. Dynamic capacity expansion
One initialization
First, there are three ways to initialize:
Public ArrayList ()
The default constructor will initialize the internal array with the default size
Public ArrayList (Collection