7.1

ArrayList Basics

AP Computer Science A

Importing ArrayList

Creating an ArrayList

Common type declarations

Wrapper classes

The core ArrayList methods

`add(E obj)` — append to end

`add(int index, E obj)` — insert at position

`get(int index)` — retrieve element

`set(int index, E obj)` — replace element

`remove(int index)` — remove by position

`size()` — number of elements

Step-by-step trace

ArrayList of objects

The `remove` trap with Integer

Bounds checking

Printing an ArrayList

Complete example: To-do list manager

AP Exam Tips

Common Mistakes

Key Vocabulary