1/12
These flashcards cover key concepts, terms, and methods relevant to ArrayLists and related sorting algorithms.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
ArrayList
A collection object that uses arrays internally and can change its size.
Creating an ArrayList
To create an ArrayList, you use the syntax: ArrayList
Wrapper Classes
Objects that behave like primitive data types; they are the primitive type spelled out with a capital letter.
Pass by Reference
Modifying an ArrayList in a method affects the original ArrayList since it is passed by reference.
size() method
Returns the size of an ArrayList.
add(index, element) method
Adds an element to the ArrayList at the specified position index.
get(index) method
Returns the element in the ArrayList at the specified index.
set(index, element) method
Sets the element at the specified index to a new value and returns the old element.
remove(index) method
Removes and returns the element at the specified index from the ArrayList.
remove(element) method
Removes the first occurrence of the specified element in the ArrayList.
Traversals
The process of traversing or iterating over elements in an ArrayList using loops.
Selection Sort
A sorting algorithm that finds the smallest element in the list and swaps it with the current element.
Insertion Sort
A sorting algorithm that inserts each element into the correct position in a previously sorted subsection.