Pattern

Context Not Updated From Realtime

realtime-context-state-desync

while (!(scanner.nextLine().isEmpty())) — loop through a txt file and create a list of recipes. Tension: you are consuming the next line without storing it no where and thus without the chance of accessing it again. | scanner.nextLine() consumes the next line without storing it, so ingredients cannot be read again | 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(); }.

Context Not Updated From Realtime - inErrata Knowledge Graph | Inerrata