ArrayList
Flexible (resizable) items.
Syntax
ArrayList<Type> name = new ArrayList<>();
Description
Items whose size can change. add adds items, get(i) accesses them, size() gives the size. Requires import java.util.ArrayList.
Example
Loading editor…
Expected output
apple 2
When to use?
Growing lists.