Standard object modelling identifies attributes, aggregates and associations of objects. You must conform to several requirements when implementing the equals()
method of a class. There is plenty of advice available on how to write this method, including pitfalls to avoid. But I couldn't find any advice indicating whether you should or should not examine associations when implementing equals()
. It is clear to me that you should examine attributes and aggregates.
Should you examine associated objects in equals()
? That is, should equality depend on associated objects?