Glossary
Algorithms
A set of well-defined instructions or a step-by-step procedure for solving a problem or performing a computation, often applied to data structures like ArrayLists.
Example:
A recipe for baking cookies is an algorithm – a precise sequence of steps to achieve a desired outcome.
ArrayList
A dynamic data structure in Java that stores a collection of items in an ordered list, allowing elements to be added or removed without a fixed size.
Example:
To manage a list of student names that frequently changes, you'd use an ArrayList
ConcurrentModificationException
An unchecked exception thrown when an object is concurrently modified while it is being iterated over, particularly if the size of an ArrayList is changed during an enhanced for loop.
Example:
Trying to remove() an element from an ArrayList while iterating over it with an enhanced for loop will likely cause a ConcurrentModificationException.
Dynamic (size)
Refers to a data structure's ability to change its size during program execution, allowing elements to be added or removed as needed.
Example:
An online shopping cart needs a dynamic size to accommodate varying numbers of items a customer might add or remove.
Encryption
The process of converting information or data into a code to prevent unauthorized access, ensuring data security and privacy.
Example:
When you send a secure message online, encryption scrambles the text so only the intended recipient can read it.
Enhanced for loop (for-each loop)
A simplified loop syntax in Java used to iterate over elements in collections like ArrayLists without needing to manage indices explicitly.
Example:
To quickly display each book in a libraryCollection ArrayList, you could use for (Book book : libraryCollection).
For or while loop
Control flow statements used to repeatedly execute a block of code, commonly employed to traverse ArrayLists by iterating through indices.
Example:
A for loop can be used to count down from 10 to 1, executing a print statement in each iteration.
Imported (java.util.ArrayList)
The process of making classes from other packages available for use in your current Java code file, necessary for using `ArrayList`.
Example:
Before using the Scanner class to read user input, you must import java.util.Scanner at the top of your file.
Insertion Sort
A sorting algorithm that builds the final sorted ArrayList one item at a time by repeatedly taking the next unsorted element and inserting it into its correct position within the already sorted portion.
Example:
When organizing a hand of cards, if you pick up a new card, you'd use insertion sort to place it directly into its correct spot among the cards you've already sorted.
Java Collections Framework
A set of interfaces and classes in Java that provide a unified architecture for representing and manipulating collections, including data structures like ArrayLists.
Example:
The Java Collections Framework provides various tools, like a HashMap for key-value pairs, in addition to ArrayLists for ordered lists.
Linear search / Sequential search
A search algorithm that sequentially checks each element in an ArrayList until the target value is found or the end of the list is reached.
Example:
If you're looking for a specific book on a shelf without any order, you'd perform a linear search by checking each book one by one.
Methods (ArrayList specific methods)
Pre-defined functions associated with the `ArrayList` class that allow you to perform operations like adding, removing, or accessing elements.
Example:
Using methods like add() and get() simplifies interacting with an ArrayList compared to direct memory manipulation.
Mutability
The property of an object whose internal state can be changed after it has been created. For ArrayLists, this means elements can be added, removed, or modified.
Example:
A whiteboard is mutable because you can write, erase, and rewrite information on it after it's set up.
Personal data
Information that can be used to identify an individual, such as names, addresses, phone numbers, or online activity.
Example:
Your full name and email address used to sign up for a website constitute personal data.
Security
Measures taken to protect data and systems from unauthorized access, use, disclosure, disruption, modification, or destruction.
Example:
Using strong passwords and two-factor authentication are common security measures for online accounts.
Selection sort
A sorting algorithm that repeatedly finds the minimum element from the unsorted portion of an ArrayList and swaps it with the first unsorted element.
Example:
To sort a hand of cards using selection sort, you'd repeatedly find the lowest card and move it to the beginning of your hand.
Sorting
The process of arranging elements in an ArrayList into a specific order, such as ascending or descending.
Example:
Arranging a deck of playing cards by suit and then by rank is an act of sorting.
Transparent (data collection)
The practice of being open and honest with users about what data is being collected, why it's collected, and how it will be used.
Example:
A website's privacy policy that clearly explains its data practices is an example of being transparent about data collection.
Traverse/Traversing ArrayLists
The process of visiting each element in an ArrayList, typically to perform an operation or access its value.
Example:
To print every item in a grocery list, you would traverse the groceryList ArrayList.
Wrapper classes
Classes in Java that encapsulate primitive data types (like int, boolean, double) into objects, allowing them to be stored in collections like ArrayLists which only hold objects.
Example:
When adding the primitive int value 5 to an ArrayList, it's automatically converted to its wrapper class equivalent, Integer.valueOf(5).
add(E obj)
An ArrayList method that appends the specified object to the end of the list, returning `true` if the operation was successful.
Example:
myPlaylist.add("New Song") would add "New Song" to the very end of your music playlist.
add(int index, E obj)
An ArrayList method that inserts the specified object at the given index, shifting any subsequent elements to the right.
Example:
If mySchedule has "Meeting" at index 0 and "Lunch" at index 1, mySchedule.add(1, "Break") would insert "Break" before "Lunch".
get(int index)
An ArrayList method that retrieves the element at the specified position in the list.
Example:
To display the first item in a todoList, you would use todoList.get(0).
remove(int index)
An ArrayList method that removes the element at the specified position in the list, shifting any subsequent elements to the left.
Example:
If guestList has 5 names, guestList.remove(0) would remove the first guest and shift all other names up one position.
set(int index, E obj)
An ArrayList method that replaces the element at the specified position with the new object, returning the element previously at that position.
Example:
If scores.get(2) was 85, then scores.set(2, 90) would change that score to 90 and return 85.
size()
An ArrayList method that returns an integer representing the current number of elements in the list.
Example:
After adding three items to your shoppingList ArrayList, shoppingList.size() would return 3.