Code Room
Code reviewMediumcr-g545
Subject Code reviewLevel Mid–Senior~16 minCommon in Code quality & review interviewsIndustries Software development

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.

Talk through your review
Code to reviewjava
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.