Lists, Arrays & Collections
Collections let you store multiple values in one variable. Loops, filters, and maps operate on collections in every Java program.
- Ordered lists — arrays, lists, vectors
- Key-value maps — objects, dictionaries, hashes
- Immutable vs mutable collections
- Iteration with for loops and higher-order methods
JAVA
int[] nums = {1, 2, 3, 4, 5};
Map<String, Integer> user = Map.of("score", 95);- Choose the right structure — array for ordered data, map for lookups
- Prefer built-in methods over manual index loops when available
- Watch for off-by-one errors in index-based loops