Code Room
Code reviewHard
Question
Review this Java method that ranks products for each user.
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
public List<Product> topForUser(User u, List<Product> products) { products.sort((a, b) -> { double sa = scorer.score(a, u); // expensive ML scoring call double sb = scorer.score(b, u); return Double.compare(sb, sa); }); return products.subList(0, Math.min(10, products.size()));}Run or narrate your approach, then ask the coach.