I am trying to implement equals
method for Java classes Book
and Chapter
in my application. Book
has a set of Chapt
From a modeling perspective, the chapter is part of the book. So although you have references in both directions, the book is "stronger" than the chapter.
When you have part-of relationships like with Book and Chapter, the part (Chapter) sometimes takes the whole (Book) into account when defining equals(). But not the other way round.
So clearly, the book would not use its chapters to define equals(). The chapter might use the book. That depends on the model.