Sahithyan's S2 — Program Construction
ArrayList
A resizable array implementation of the List
interface from the Java
Collections Framework. Allows dynamic resizing and provides methods to
manipulate the stored elements. Supports a generic to hint the type of elements.
Cannot hold primitive types, like int, char, etc. Wrapper classes are needed.
By default, an ArrayList
has an initial capacity of 10 elements. When the number of elements exceeds this capacity, the ArrayList
automatically increases its capacity by approximately 50%. Each element has a memory overhead of 24 bytes.
Complexity
Operation | Time | Space |
---|---|---|
Inserting Element in ArrayList | ||
Removing Element from ArrayList | ||
Traversing Elements in ArrayList | ||
Replacing Elements in ArrayList |