commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurent Perez" <>
Subject Re: [lang] equalsBuilder unexplained wrong equality with java.lang.Longs ?
Date Mon, 17 Dec 2007 12:37:30 GMT
(sorry for the double list post if two mails went in, I received a
mailer daemon error on two posts attemps)

Thanks Gary for your explanation, I also had a look at Long javadoc
and seeing its overriden equals(), I understand my false boolean when
doing "==".

However, as Jörg said, I don't understand why EqualsBuilder isEquals
seem to use object identity "==" and not identitity.

I thought it may be related to the appendSuper(super.equals(object)),
but my bean does not extend some weird class, however, it implements
Serializable, with an eclipse-generated serialVersionUID of

Would it relate to my hashcode() instead ? Mine uses the Long id
property too, and is :
public int hashCode() {
		return new HashCodeBuilder(1054718011, -1215537567).appendSuper(


2007/12/17, Jörg Schaible <>:
> Gary Gregory wrote:
> > Hello Laurent:
> >
> > This behavior is 'normal'. The concepts of object equality
> > (the equals() method) and object identity (==) are different.
> Well, this was not Laurent's question. He was wondering, why the EqualsBuilder seems
to use in his example the Long objects' identity instead of their equals method.
> [snip]
> - Jörg
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

<a href="">
- Mobile world, technology and more</a>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message