Why is it needed to override equals () method in each DTO class?

You must have to override both equals() and hashCode() method in Java , otherwise your value object will not be able to use as key object in HashMap because working of HashMap is based on equals() and hashCode to read more see , How HashMap works in Java.23 Eyl 2021

Sizin İçin Seçtik  Is == and equals same in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *