On Wed, 21 Nov 2007 10:57:46 -0200, Ritesh.S <[EMAIL PROTECTED]> wrote:
If I am not bothering you, I will like to ask you for which classes or
situations this equals method overriding is necessary. If you like to
answer I would
like to know.
If your objects can be added to a collection, you need to at least
override the equals() method. If they can be added to a map (including
hash tables), you need to override both equals() and hashCode(). On the
othher hand, it is a good practice to override both equals() and
hashCode() for every entity class.
For more information, take a look at
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)
and
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#hashCode().
--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]