Code Room
Code reviewHard
Question
Review this Java method that counts occurrences of each integer key in a high-volume stream of events.
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
Map<Integer, Integer> countKeys(int[] keys) { Map<Integer, Integer> counts = new HashMap<>(); for (int k : keys) { Integer cur = counts.get(k); counts.put(k, cur == null ? 1 : cur + 1); } return counts;}Run or narrate your approach, then ask the coach.