What this deck covers
This deck focuses on Implementing Arraylist Algorithms, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Study Implementing Arraylist Algorithms in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.
0% Complete
What method swaps two elements at specified positions in an ArrayList?
Tap card or press Space to flip
Collections.swap(list, i, j). Exchanges elements at positions i and j using Collections utility.
How well did you know it?
Card 1 / 55
Space to flip · ← / → to move · once flipped, → Got it · ← Still learning
This deck focuses on Implementing Arraylist Algorithms, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.
Answer: Collections.swap(list, i, j). Exchanges elements at positions i and j using Collections utility.
Answer: add(index, element). Inserts element at specified position, shifting subsequent elements right.
Answer: addAll(Collection<? extends E> c). Appends all elements from another collection to current ArrayList.
Answer: Collections.reverse(list). Uses Collections utility to reverse element order in place.
Answer: size(). Returns current number of elements stored in the ArrayList.
Answer: get(index). Directly accesses element at specified position without modification.
Answer: size(). Returns current number of elements stored in the ArrayList.
Answer: set(index, element). Replaces existing element at specified position with new element.
Answer: list.toArray(new String[0]). Converts to String array with proper type safety using parameterized method.
Answer: indexOf(element). Returns position of first matching element, or -1 if not found.
Answer: iterator(). Provides forward-only traversal through ArrayList elements.
Answer: O(n). Linear time due to shifting all subsequent elements left.
Answer: toArray(). Converts ArrayList to standard array containing all elements.
Answer: import java.util.ArrayList;. Required import statement to use ArrayList class in Java programs.
Answer: sort(Comparator<? super E> c). Sorts using custom comparison logic defined by Comparator implementation.
Answer: sort(Comparator<? super E> c). Sorts using custom comparison logic defined by Comparator implementation.
Answer: Collections.shuffle(list). Randomly reorders elements using Collections utility method.
Answer: O(1) on average. Constant time unless internal array needs resizing (rare case).
Answer: isEmpty(). Returns true if ArrayList contains no elements (size is zero).
Answer: clear(). Removes all elements from the ArrayList, making it empty.
Answer: ArrayList list = new ArrayList<>();. Creates new ArrayList with String generic type using diamond operator.
Answer: remove(index). Removes element at specified position, shifting subsequent elements left.
Answer: get(index). Directly accesses element at specified position without modification.
Answer: remove(index). Removes element at specified position, shifting subsequent elements left.
Answer: lastIndexOf(element). Finds rightmost position of element, or -1 if not found.
Answer: isEmpty(). Returns true if ArrayList contains no elements (size is zero).
Answer: toArray(). Converts ArrayList to standard array containing all elements.
Answer: Collections.shuffle(list). Randomly reorders elements using Collections utility method.
Answer: O(n). Linear time due to shifting all subsequent elements left.
Answer: addAll(Collection<? extends E> c). Appends all elements from another collection to current ArrayList.
Answer: set(index, element). Replaces existing element at specified position with new element.
Answer: Collections.reverse(list). Uses Collections utility to reverse element order in place.
Answer: Collections.sort(list). Uses Collections utility class to sort elements in ascending order.
Answer: iterator(). Provides forward-only traversal through ArrayList elements.
Answer: ArrayList list = new ArrayList<>();. Creates new ArrayList with String generic type using diamond operator.
Answer: add(index, element). Inserts element at specified position, shifting subsequent elements right.
Answer: Collections.copy(dest, src). Copies elements from source to destination ArrayList using Collections.
Answer: contains(element). Returns true if ArrayList contains at least one instance of element.
Answer: list.toArray(new String[0]). Converts to String array with proper type safety using parameterized method.
Answer: contains(element). Returns true if ArrayList contains at least one instance of element.
Answer: add(element). Appends element to the end of the ArrayList.
Answer: Collections.fill(list, value). Uses Collections utility to replace all elements with single value.
Answer: O(1). Constant time since ArrayList uses array indexing internally.
Answer: Collections.sort(list). Uses Collections utility class to sort elements in ascending order.
Answer: Collections.copy(dest, src). Copies elements from source to destination ArrayList using Collections.
Answer: remove(Object o). Removes first matching element based on equals() comparison.
Answer: Collections.swap(list, i, j). Exchanges elements at positions i and j using Collections utility.
Answer: indexOf(element). Returns position of first matching element, or -1 if not found.
Answer: subList(int from, int to). Returns view of portion between indices (exclusive of 'to' index).
Answer: subList(int from, int to). Returns view of portion between indices (exclusive of 'to' index).
Answer: remove(Object o). Removes first matching element based on equals() comparison.
Answer: clear(). Removes all elements from the ArrayList, making it empty.
Answer: lastIndexOf(element). Finds rightmost position of element, or -1 if not found.
Answer: Collections.fill(list, value). Uses Collections utility to replace all elements with single value.
Answer: import java.util.ArrayList;. Required import statement to use ArrayList class in Java programs.