If both (hash code & properties value) are same then the object is considered equal otherwise not equal. Their hash code and properties are compared. hashCode()is a unique hash/number attached to every object whenever the object is created.equals()method is used to compare two objects based on their properties.I have also override the Hash and Equals method. This is a concrete class which contains Product properties and provides setters and getters for it. I will take each class one by one and explain the significance of it. For simplicity, all of the code will reside inside this package.įor this example project, make sure all of the above-mentioned classes resides under the same package, i.e, collections.shoppingcart.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |