I have a set of Car where class Car is as follows:
public class Car{ private Tyre tyre; private Engine engine; } In order to use Set for car for avoiding duplicates, I need to override hashcode and equals for Car class. My questions is do I also need to implement equals and hashcode for Tyre and Engine class?