@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null )
return false;
if (getClass() != obj.getClass())
return false
Instructor other = (Instructor) obj;
if (name != other.name )
return false
return true
}
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);
}