S. Palanigounder wrote:Ulises, Can you provide the override implementation for hashCode and equals that works?
Well there is no equals and hascode implementation that can fit for all the objects.
Depending on the class you have created is the implementation you can do. What I can give you are the rules for the implementation.
If x == y then it must be that x.hashcode == y.hashcode
If x != y then x.hashcode might be == or != than y.hashcode
If x.equals(y) is true then it must be that x.hashcode == y.hashcode.
If !x.equals(y) then x.hashcode might be == or != than y.hashcode.
if x.equals(y) and y.equals(z) then x.equals(z). The same goes for hashcode.
Once you have implemented both methods and they behave as the rules stated before then you can say that you have a correct implementation of both methods.
SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCJD, SCEA in progress
www.ulisespulido.com