Skip to content
Snippets Groups Projects
Commit 095514b0 authored by HSoreide's avatar HSoreide
Browse files

Write first draft of the RecipeRegister class

parent 0d8d7742
No related branches found
No related tags found
1 merge request!7Create food and recipe classes with tests
package no.ntnu.idatt1002.demo.data.recipes;
import java.util.ArrayList;
import java.util.List;
public class RecipeRegister {
private List<Recipe> recipes = new ArrayList<>();
//TODO: Copy-constructor
public void addRecipe (Recipe recipe) {
if(recipes.contains(recipe)) {
throw new IllegalArgumentException("The recipe already exists in the register."); // Or just replace?
} else if (recipe == null) {
throw new IllegalArgumentException("The recipe cannot be null.");
}
this.recipes.add(recipe);
}
}
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