lets say you have a HashSet which is an unordered set. now you know that Set cannot contain duplicates. when we say 'No duplicates' that mean 2 or more objects should NOT be equal. here you can see the need of establishing equality of 2 or more objects. In case of Maps , suppose you have a class Car . now consider you have a Map which maps 'Car' objects to
String representing owner of the car. You constructed a Car object with properties say color=red, gear=automatic and added it to the Map. now suppose you don't have the reference of that Car object you added and you want to retrieve the owner corresponding to the car you just added. what will you do ? may be you thing that let me make a new Car object Car c = new Car("red, "automatic") and use that object to retrieve the owner. but since you haven't overridden the equals method in your Car class, the new Car object (Car c = new Car("red","automatic")) will be different from the one you added. so you won't be able to find the owner. so you have to establish the equality of the Car objects in some way. how the equality is to be defined is depending upon your need .