I understand the contract between hashcode() and equals(). What I don't understand is that should I include all the fields of my class(bean) while calculating the same? e.g. I need to use my bean object in hash based collection and requires sorting. The bean class contains ~25 fields.
Is it necessary to consider all of its field while overriding HashCode() and euqals()?