1/24
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Primitive type
A basic Java type (e.g., int, double) that stores a raw value directly and is not an object.
Reference type
A Java type that refers to an object (a class type), can be used with generics, and can be null.
Wrapper class
A class that represents a primitive value as an object so it can be used where objects are required (e.g., in generics/ArrayLists).
Integer (wrapper)
The wrapper class that stores an int value as an object.
Double (wrapper)
The wrapper class that stores a double value as an object.
Generics
Java feature using type parameters like ArrayList
ArrayList
A resizable, indexed list from java.util that stores objects and can grow/shrink during execution.
Type parameter (e.g., E in ArrayList
The specified element type for a generic class (e.g., String in ArrayList
Autoboxing
Automatic conversion of a primitive to its wrapper object (e.g., int to Integer) when needed.
Unboxing
Automatic conversion of a wrapper object to its primitive value (e.g., Integer to int) when needed.
NullPointerException (unboxing null)
Error that can occur if a null wrapper reference (e.g., Integer) is automatically unboxed to a primitive.
== vs .equals(…) (objects)
== compares object references (identity), while .equals(…) compares values/content (when implemented appropriately).
Floating-point precision (Double)
Limitation of double/Double where rounding can make values that “should” match fail exact equality comparisons.
Zero-indexed
Indexing rule where the first element is at index 0 and the last is at index size() - 1.
IndexOutOfBoundsException
Exception thrown when accessing or modifying an ArrayList with an invalid index (e.g., index < 0 or index >= size()).
size()
ArrayList method that returns the number of elements in the list; last valid index is size() - 1.
add(E obj)
ArrayList method that appends an element to the end of the list and increases size by 1.
add(int index, E obj)
ArrayList method that inserts an element at a given index and shifts existing elements at/after that index to the right.
get(int index)
ArrayList method that returns the element at the given index without changing the list.
set(int index, E obj)
ArrayList method that replaces the element at index, returns the old value, and keeps the same list size.
remove(int index)
ArrayList method that removes and returns the element at index and shifts later elements left.
remove overload gotcha (ArrayList
With ArrayList
Enhanced for loop (for-each)
Traversal that visits each element for reading (e.g., for (String s : words)); generally not used for structural add/remove.
Backward traversal for removals
Safe pattern for removing elements: loop from size() - 1 down to 0 so shifting doesn’t skip unvisited elements.
Integer division vs casting to double
If both operands are int, division truncates; cast (e.g., (double) sum / size()) to compute a decimal average.