Hash Code and Equals method Contract in java

preview_player
Показать описание
This video tutorial describes contract between equals and hash code method.
if two objects are equal by equals method then hash code must be same



Two diffrent object may have same hash code

Always override hash code when you overrides equals . Not doing so will prevent from functioning properly in all hash based collections hash map, hash set.

Also,explains why necessary to override equals and hashcode both.
Рекомендации по теме
Комментарии
Автор

I just discovered your videos and I love them pleaase keep doing them It helps a lot! greetings !

culturestalk