Skip to content
Snippets Groups Projects
Commit 80abb2af authored by HSoreide's avatar HSoreide
Browse files

Make ingredients sorted alphabetically

parent 12904e22
No related branches found
No related tags found
2 merge requests!42Hs frontend recipes,!41Hs frontend recipes
......@@ -65,7 +65,7 @@ public class AddIngredientController implements Initializable {
ingredientsList = stringIngredients.stream().toArray(String[] ::new);
ingredients = FXCollections.observableArrayList(stringIngredients);
// Fill list with ingredients
listView.setItems(ingredients);
listView.setItems(ingredients.sorted());
}
......
......@@ -79,7 +79,7 @@ public class SuggestRecipesController implements Initializable {
//TODO: Duplicate code and assertion.
assert ingredientsAtHand != null;
fridge = FXCollections.observableArrayList(ingredientsAtHand.getIngredientsAtHand().stream().map(foodItem -> foodItem.label).toList());
fridgeList.setItems(fridge);
fridgeList.setItems(fridge.sorted());
setRecipeTiles();
}else if(clickedButton.get() == ButtonType.CANCEL) {
......@@ -96,7 +96,7 @@ public class SuggestRecipesController implements Initializable {
//TODO: Remove toUppercase solution above.
//TODO: Consider factoring out to a update method.
fridge = FXCollections.observableArrayList(ingredientsAtHand.getIngredientsAtHand().stream().map(foodItem -> foodItem.label).toList());
fridgeList.setItems(fridge);
fridgeList.setItems(fridge.sorted());
setRecipeTiles();
}
......@@ -187,7 +187,7 @@ public class SuggestRecipesController implements Initializable {
ingredientsAtHand = FileHandler.readIngredientsAtHand("Fridge");
fridge = FXCollections.observableArrayList(ingredientsAtHand.getIngredientsAtHand().stream().map(foodItem -> foodItem.label).toList());
//List<String> fridgeLabels = fridge;
fridgeList.setItems(fridge);
fridgeList.setItems(fridge.sorted());
recipeRegister = FileHandler.readRecipeRegister("Recipes");
recipes = FXCollections.observableArrayList(recipeRegister.getRecipes());
......
TOMATO
WHEAT_FLOUR
ONION
EGG
......@@ -20,3 +19,4 @@ OLIVE_OIL
OIL
BUTTER
GARLIC_CLOVE
HAM
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment