Collections in Java
The Collections Framework gives ready-made structures for groups of objects. List: ordered, duplicates allowed — ArrayList. Set: unique elements — HashSet. Map: key → value — HashMap (Map is separate but part of the same story).
Prefer generics: List<String> so types stay safe. Pick by need: fast index get → ArrayList; uniqueness → HashSet; key lookup → HashMap. Don’t use a raw array for everything that must grow or shrink.
Draw List vs Set vs Map in ten seconds with one property each.
Let's take this on the board with one tiny Main class — no extra files. Collections in Java — output: 3. Three real names: Asha, Ravi, Neha. size() is 3. Start from main, go line by line, and stop at each print. That output is the proof for Collections.
List → order + duplicates (ArrayList) Set → unique only (HashSet) Map → key → value (HashMap)
List / Set / Map — one line each.