Actually what happens to me.
Today I see the Collection interface carefully.
There I see a method int hashCode() and the class which by default extends Object and implements Collection interface or it's sub-interfaces have to implement the method int hashCode().
That's why I questioned it.
Kind regards,
Dmjpro.
You don't *have to* implement hashCode() and its compadre equals(), those
methods are just part of the interface to emphasize that you should reimplement
them in several occasions. Read the Collection API docs for those two methods.
And of course, if you don't implement them the interface contract is still fulfilled
because the Object class implements them both (but not the way some collections
expect them to be implemented).
kind regards,
Jos