Course home
OOP THROUGH JAVA UNIT IV · UI24PC320CS JDK 21
4UNIT

12 classes · 3 labs · 10 PYQs

The Collections framework & utilities.

Arrays that resize themselves — ArrayList, LinkedList, HashSet, TreeSet, HashMap · iterators · the legacy toolbox (StringTokenizer, BitSet, Date, Calendar, Random, Timer) · and custom sorting with Comparable & Comparator.

PART M · C37–C40 · LISTS & SETS LAB 9 · LIST/SET PRACTICE PART N · C41–C44 · MAPS + LEGACY UTILITIES LAB 10 · UTILITIES PART O · C45–C48 · SORTING + CLOSE LAB 11 · COMPARATOR SORTS

THE ROADMAP · C37 → C48

Twelve classes. Three labs. A library, a car catalog, and a playlist.

Part M builds lists & sets on a com.vce.library Book spine. Part N runs maps and the legacy utility toolbox on com.vce.carcatalog and a delivery-partner domain. Part O sorts everything your way — Comparable, Comparator, multi-key — on a Spotify-style playlist.

PART M · C37–C40 · COLLECTIONS, LISTS & SETS
C37CLASS
The Collection framework & iterators

Why arrays weren't enough — the interface family tree, Iterator vs for-each, and fail-fast surprises. (P1·Q7)

PART MSOON
C38CLASS
Lists — ArrayList, LinkedList, Vector, Stack

The resizable array vs the chain of nodes — costs of get/add/remove, and where the legacy pair still appears.

PART MSOON
C39CLASS
Sets — HashSet & LinkedHashSet

No duplicates, ever — hashing under the hood, why order vanishes, and how LinkedHashSet buys it back.

PART MSOON
C40CLASS
TreeSet & the Comparable primer

Sorted the moment it enters — natural ordering, compareTo, and the Lab 9 runway. (P2·Q6 · P2·Q14b)

PART MSOON
L9LAB
Lab 9 · List & Set practice

The library Book domain at the keyboard — build, iterate, dedupe, sort naturally.

LAB 9SOON
PART N · C41–C44 · MAPS & THE LEGACY TOOLBOX
C41CLASS
Maps — key → value at last

HashMap, LinkedHashMap, TreeMap — put/get/containsKey, entrySet loops, and the car-catalog registry.

PART NSOON
C42CLASS
StringTokenizer, BitSet & Random

The legacy utility trio — splitting CSV rows, flag sets, and reproducible randomness. (P1·Q8 · P2·Q7 · P2·Q8)

PART NSOON
C43CLASS
Date & Calendar

Reading the clock the old way — Date's quirks, Calendar's fields, and formatting timestamps for real records.

PART NSOON
C44CLASS
Timer & TimerTask — and the Lab 10 runway

Scheduling work on a clock — delayed and repeating tasks for the delivery-partner domain. (P1·Q14b · P2·Q14a)

PART NSOON
L10LAB
Lab 10 · Utility classes

Tokenizers, bit sets, dates and timers — Part N's toolbox, hands-on.

LAB 10SOON
PART O · C45–C48 · SORTING YOUR WAY & CLOSE
C45CLASS
Comparable vs Comparator — the named forms

compareTo inside the class vs compare outside it — when each wins, on the playlist domain.

PART OSOON
C46CLASS
Multi-key sorting

Sort by artist, then by plays, then by title — chaining comparators for real-world orderings. (P1·Q17b)

PART OSOON
C47CLASS
The Arrays utility class

sort · binarySearch · fill · copyOf · toString — the static toolbox for plain arrays. (P2·Q17b)

PART OSOON
C48CLASS
Unit 4 close — the full picture

Framework map → legacy toolbox → sorting, stitched into one revision sweep, plus the Lab 11 runway.

PART OSOON
L11LAB
Lab 11 · Comparator sorts

Multi-key playlist sorting at the keyboard — the unit's capstone.

LAB 11SOON

10 past-paper questions live inside this unit.

Part M carries P1·Q7 (framework & iterators) plus P2·Q6 and P2·Q14b (TreeSet & natural ordering). Part N carries P1·Q8, P2·Q7 and P2·Q8 (StringTokenizer / BitSet / Random) plus P1·Q14b and P2·Q14a (Timer & TimerTask). Part O carries P1·Q17b (multi-key Comparator sort) and P2·Q17b (Arrays utility). Every one appears as a stepped model program inside its class.