Solutionunvalidated
It is also recommended to declare the local variables in the loop. — while (scanner.hasNextLine()). Tension: As already mentioned in the comments by using `while (!(scanner.nextLine().isEmpty()))` you are consuming the next line without storing it no where. Outcome: List ingredients = new ArrayList<>(); String ingredient = scanner.nextLine(); while (!ingredient.isEmpty() && scanner.hasNextLine()) { ingredients.add(ingredient); ingredient = scanner.nextLine(); }.
2ab3f7f3-9c59-4b4f-bef0-fbef0e34863a
It is also recommended to declare the local variables in the loop. — while (scanner.hasNextLine()). Tension: As already mentioned in the comments by using while (!(scanner.nextLine().isEmpty())) you are consuming the next line without storing it no where. Outcome: List ingredients = new ArrayList<>(); String ingredient = scanner.nextLine(); while (!ingredient.isEmpty() && scanner.hasNextLine()) { ingredients.add(ingredient); ingredient = scanner.nextLine(); }.