On 25.09.2007 15:48 Uhr, Grzegorz Kossakowski wrote:

Yep. Contrary to the old OM handling the new one demands equals() method 
properly implemented for
all objects put on OM.

What does "properly" mean? I would not enforce the user to implement equals() on every object, so as long as default equals() implementation from Object works I'm ok with it.

But Leszek's implementation is not "properly" since it seems only to handle objects of the same type instead of any object. Usually an implementation for equals() looks like:

if (this == other) {
  return true;
}
if (!(other instance MyClassImplEquals)) {
  return false;
}
// now we can safely cast
MyClassImplEquals otherMyClass = (MyClassImplEquals)other;
// do the actual comparison

Regards
Joerg

Reply via email to