Code Room
Code reviewMediumcr-g479
Subject Regex recompileLevel Mid–Senior~16 minCommon in Code quality & review interviewsIndustries Software development

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.

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