Code Room
Code reviewMedium
Question
Review this Java log filter run over every line of a large file.
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
List<String> errors(List<String> lines) { List<String> out = new ArrayList<>(); for (String line : lines) { if (line.matches("^\\d{4}-\\d{2}-\\d{2}.*\\bERROR\\b.*")) { out.add(line); } } return out;}Run or narrate your approach, then ask the coach.