public class Arraylist<e> extends Abstractlist<e>i mplements list<e>, Randomaccess, Cloneable, Serializable
ArrayListis a realization of theListThe size of the interface is variableArray. Implements all the optionalListoperation, and includes the AllowNULLall elements are included. In addition to implementingListinterface, this class also provides methods to manipulateArraythe size, here's theArraysize refers to the interior used to storeListthe size. (This class is roughly equivalent toVectorclass, except this class is not synchronized. )
these operations such as size,isEmpty,get,set, Both iterator and listiterator are run at a fixed time ( run in constant time). Add operations are run at a fixed time that is apportioned, that is, adding N elements require a O (n) time. All other operations run in linear time (broadly speaking). This implementation has a low constant factor compared to the constant factor used for LinkedList implementations.
Each ArrayList instance has a capacity. This capacity refers to the size of the array used to store the list elements. It is always at least equal to the size of the list. As You add elements to the ArrayList, their capacity increases automatically. The details of the growth strategy are not specified, as it is not just the addition of elements that can be as simple as allocating fixed-time overhead.
ArrayList can only hold objects, and the value is run-time judgment rather than compile-time judgment, that is, only at run time to know that the object you want to get and the actual object is consistent, whether throws an exception.
Several special methods:
void Add (int index, E Element)
Inserts the specified element into the specified position in this list.
Boolean addall (int index, COLLECTION<? extends e> c)
Inserts all elements from the specified collection into this list, starting at the specified location.
Boolean remove (Object o)
Removes the specified element (if any) that first appears in this list.
protected void RemoveRange (int fromIndex, int toindex)
Removes all elements in the list between FromIndex(inclusive) and toindex(not included).
Java Records -42-java ArrayList