Thursday, 19 June 2014

hashCode and equals

Lets understand with a small example where and why hashCode and equals are used.


Java.lang.Object has methods called hasCode() and equals(). These methods play a significant role in the real time application. However its use is not always common to all applications. In some case these methods are overridden to perform certain purpose. I will explain you some concept of these methods and why it becomes necessary to override these methods.