Collect every validation error in Java
Java interview exercise on Exceptions & validation, difficulty 1 of 3. Solve it in the editor beside a worked example; the tests run the moment you do.
Write validate(email, age) that returns a list of every problem found, in this order, so a form can show them all at once: "email is required" (null or blank), else "email must contain @"; "age must be between 0 and 150". A valid pair gives an empty list. No exceptions here: a validation report is data.
Each exercise pairs a worked example with a twin problem to solve in a real editor; the tests run the moment you do. Progress is saved in your browser, and in your account if you sign in.