Lesson 6.1 · College Board Unit 4
ArrayList Basics
ArrayList grows and shrinks. Use size() for its element count, get(index) for access, and set(index, value) to replace an existing element.
Code Scholars Tutoring · AP Computer Science A
A resizable list of objects. The unit adds one genuinely tricky behavior: removing during a traversal shifts every later element, so the loop and the list disagree about where things are.
Lesson 6.1 · College Board Unit 4
ArrayList grows and shrinks. Use size() for its element count, get(index) for access, and set(index, value) to replace an existing element.
Lesson 6.2 · College Board Unit 4
Indexed add shifts later elements right; indexed remove shifts them left. With ArrayList<Integer>, remove(int) selects an index, not a matching value.
Lesson 6.3 · College Board Unit 4
An indexed loop can replace elements or manage shifting indices. Avoid structural list changes during an enhanced for traversal.
Lesson 6.4 · College Board Unit 4
Generic collections store reference types, so use Integer and Double rather than int and double. Boxing and unboxing connect primitive values with their wrappers.
Work through questions with a tutor and get help with the steps you find difficult.
Get help with this topic