Code Room
Code reviewHardcr-g453
Subject Comparator violationsLevel Senior–Staff~22 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Java comparator that sorts trade fills by execution price (a double that can be NaN for voided fills).

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<Fill> fills = ...;fills.sort((x, y) -> {    if (x.price < y.price) return -1;    if (x.price > y.price) return 1;    return 0;});
Run or narrate your approach, then ask the coach.