Code Room
Code reviewMedium
Question
Review this Java method that evicts expired sessions from a shared map.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
void evictExpired(Map<String, Session> sessions, long nowMs) { for (Map.Entry<String, Session> e : sessions.entrySet()) { if (e.getValue().expiresAt < nowMs) { sessions.remove(e.getKey()); } }}Run or narrate your approach, then ask the coach.