tags:

views:

79

answers:

1

Possible Duplicate:
Best practices regarding equals: to overload or not to overload?

Does anyone overload the equals method in java? The overloaded method will be

public boolean equals(final MyClass myClass)

This will have the benefit of having the relevant comparison part (guts of the method) in another method. Details are in my blog.

EDIIT : This is a genuine question. Link to the blog entry removed.

+1  A: 

IMO, it would be a bad idea because it would be liable to confuse someone reading your code. I'd never do it.

If it becomes necessary to provide an "equality" method that does not override boolean equals(Object), it is a much better idea to give it a different method name.

Stephen C