Skip to main content

Checkpoint: the hostile-reviewer Session

Challenge on lesson: Checkpoint: Hostile-Reviewer Session

CHALLENGE
Difficulty: advanced+25 XP

Implement static final class Session + helper: 1. Constructor Session(List<String> events) โ€” defensively copies. 2. events() returns an unmodifiable view; add(String e) mutates internal state only. 3. String describe() returns "Session[n]" with n = current event count. 4. static String safeTrace() โ€” creates a Session from a mutable list, mutates that external list afterwards, then returns the Session's describe() value. The tests simulate all three hostile reviewers.

Back to lesson: Checkpoint: Hostile-Reviewer Session