In AP Computer Science A, a list is an ordered collection of elements where each element sits at a unique index starting from 0. You work with lists through Java's ArrayList class, which can grow and shrink as you add and remove elements, unlike a fixed-length array.
A list is an ordered collection of elements where every element has its own position, called an index. Order matters. The element at index 0 stays at index 0 until something explicitly moves it, so a list is basically a numbered lineup of data.
In AP CSA, "list" almost always means ArrayList, Java's resizable list class. You declare one like ArrayList<Integer> nums = new ArrayList<Integer>(); and manage it with a small set of methods: add(element) to append, add(index, element) to insert, get(index) to read, set(index, element) to replace, remove(index) to delete, and size() to count elements. Two things trip people up. First, indices run from 0 to size() - 1, so get(list.size()) throws an IndexOutOfBoundsException. Second, when you add or remove in the middle, every element after that spot shifts, and their indices change. That shifting behavior is the source of half the ArrayList bugs you'll ever write.
Lists live in the data collections portion of the course, the same stretch that covers arrays, traversals, and searching and sorting algorithms. Nearly every algorithm question in that part of the course assumes you can store data in an ArrayList, walk through it with a loop, and read or change elements by index. Lists are also where the exam tests dynamic behavior. Arrays have a fixed length, so any question about a collection that grows as a program runs (adding reviews, enrolling students, collecting scores) is really a list question. If you can't traverse an ArrayList confidently, including removing elements without skipping any, the free-response section gets very hard very fast.
Array (Unit 4)
An array is a list's fixed-size cousin. Both store elements in indexed order, but an array's length is locked at creation while an ArrayList resizes itself. Even the syntax splits: arrays use arr[i] and arr.length, lists use list.get(i) and list.size().
Index (Unit 4)
The index is what makes a list a list instead of just a pile of values. Every element has a position from 0 to size minus 1, and that numbering is how every other list operation, from get to linear search, finds anything.
Traversal (Unit 4)
A traversal visits every element of a list, usually with a for loop running from 0 to size() - 1 or an enhanced for loop. Almost every list FRQ is secretly a traversal FRQ, since you have to loop through the list to count, sum, find, or modify elements.
Linear Search Algorithm (Unit 4)
Linear search is the go-to way to find a value in a list. It checks elements one index at a time from the front, which means it runs in O(n) time. Searching [4, 8, 15, 16, 23, 42] for 23 takes 5 comparisons because 23 sits at index 4.
Multiple-choice questions hand you a snippet of ArrayList code and ask what it prints, how many comparisons a search makes, or which line throws an IndexOutOfBoundsException. Algorithm questions lean on lists too, like asking the time complexity of a linear search through an ArrayList (it's O(n)) or which data structure suits a sequential search. On the free response, one question is traditionally devoted to ArrayList. The 2022 FRQ Q3, for example, stored Review objects in an ArrayList and asked you to traverse it, pull data out with get, and build a new list from the results. You need to write traversals from scratch, use add, get, set, remove, and size correctly, and handle the classic trap of removing elements during a loop without skipping the element that shifts into the removed slot.
Both are ordered, indexed collections, but an array has a fixed length set at creation while a list (ArrayList) grows and shrinks dynamically. The syntax is completely different too. Arrays use bracket notation like arr[2] = 5 and the length field; ArrayLists use method calls like list.set(2, 5) and size(). Mixing these up, like writing list[2] or arr.get(2), is a guaranteed lost point on the FRQ.
A list is an ordered collection where each element has a unique index, and in AP CSA you use it through Java's ArrayList class.
List indices run from 0 to size() - 1, and accessing anything outside that range throws an IndexOutOfBoundsException.
The core ArrayList methods are add, get, set, remove, and size, and they replace the bracket notation you use with arrays.
Adding or removing an element in the middle of a list shifts every element after it, which changes their indices.
When you remove elements while traversing a list, you have to adjust your loop index or you'll skip the element that slides into the removed spot.
A linear search through a list checks one element per comparison from index 0, so it runs in O(n) time.
A list is an ordered collection of elements where each element has a unique index starting at 0. On the AP CSA exam you work with lists through Java's ArrayList class, using methods like add, get, set, remove, and size.
No. Both are ordered and indexed, but an array's length is fixed when you create it while an ArrayList resizes automatically as you add or remove elements. They also use different syntax, with brackets and length for arrays versus method calls and size() for ArrayLists.
They start at 0, just like arrays and strings in Java. The last valid index is size() - 1, so calling get(list.size()) crashes with an IndexOutOfBoundsException.
Not directly. ArrayLists only hold objects, so you use the wrapper classes Integer and Double, as in ArrayList
Multiple-choice questions trace ArrayList code or count comparisons in a search, like finding that locating 23 in [4, 8, 15, 16, 23, 42] takes 5 comparisons. The free-response section traditionally includes an ArrayList question, such as 2022 FRQ Q3, where you traverse a list of objects and build or modify lists with add, get, and remove.