In reply to Aron.
toString()
is the same story. Overriding is fine.
Overloading isn't a good...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-127411
In reply to Aron.
Yes, overriding hashCode()
and
equals()
is fine - it...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-127410
In reply to Aron. Ah - who is ever going to do any kind of import, in order to override Object.equals()? ...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-127409
In reply to Aron. Ok - I mean besides from toString(), because this is a very convenient way of making de...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-127407
I once read a book, while I was trying to perfect my skills in Java. It told me exactly how to override hashCode() and other methods in Object, if I really wanted to override Object.equals(). Doe...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-127406
In reply to trejkaz. My friend, I've seen code worse than your worst nightmares. But you're right indeed....
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-126928
In reply to lukaseder. You can't delete a method which is in a library like Commons Lang. You can't remov...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-126925
In reply to trejkaz. You're certainly either:
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-126924
In reply to lukaseder. In a code review, I have to go out of my way to view any code which is outside of ...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-126922
In reply to JB Giraudeau (@jb9i). Good point, although, I think the whole package deserves deprecation in...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-126917
The first problem could be alleviated by overriding Object.equals and annotating it with @deprecated (implementation being super.equals).
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-126914
In reply to trejkaz.
(I agree the ObjectUtils.equals()
example might be bad in
this particul...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-126911
I disagree with things like ObjectUtils.equals being a bad idea for that reason. Rather, static import is the bad idea in that example. When you use static import, irrespective of how the *compil...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-126904
In reply to Kim.
Yes, I agree. On the flip side, Objects
is a little less
tedious to type or...
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-125384
Java 7 defines java.lang.Objects.equals which is similar to Apache's ObjectUtils. It has the same problems in regard to static import. However, it's standard api.
https://blog.jooq.org/thou-shalt-not-name-thy-method-equals/#comment-125372