🍄 🐘 🦆 🐟 🐍 🦋 🐸 🦖🌳 🌸 🍓 🥒 🍎 🥜🌿
0,1
0,*
public class Book {
private List<Review> reviews;
// ...
}public class Review {
private Book book;
// ...
}public class Book {
// ...
private List<Review> reviews;
public void addReview(Review review) {
}
}public class Review {
// ...
private Book book;
public void setBook(Book book) {
}
}if (!this.reviews.contains(review)) {
this.reviews.add(review);
review.setBook(this);
}if (this.book != book) {
this.book = book;
book.addReview(this);
}public void addIngredient(Ingredient ingredient) {
if (!this.ingredients.contains(ingredient)) {
ingredients.add(ingredient);
ingredient.addRecipe(this);
}
}public void addIngredient(Ingredient ingredient) {
}Don't miss Part 2!