commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurent Perez" <>
Subject [lang] equalsBuilder unexplained wrong equality with java.lang.Longs ?
Date Sun, 16 Dec 2007 23:28:08 GMT
Hi !

I'm struggling with a problem I don't understand, my equalsBuilder's
isEquals seem to return false when dealing with Longs :

I have a bean class UiTheme, with a property private Long id.

The following equals builder will return false when = 1 and =  1 :

        public boolean equals(Object object) {
                if (!(object instanceof UiTheme)) {
                        return false;
                UiTheme rhs = (UiTheme) object;
                return new

If I manually do the equality, as in, then it
is true (because, well... 1 = 1 !)
If I do an equality like ==, then it is false (being a
Java newbie... maybe it should be false, not sure if doing == instead
of equals(obj) is correct with Longs)

So I assume (am I wrong ?) that equalsBuilder's isEquals uses "=="
instead of "equals(obj)"... but I really, really don't understand why.

Can anyone enlighten me ?

thanks !

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

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

View raw message