我见过许多javaequals()方法的实现,它们遵循以下几行: if (this == other)//check all the attribute of this and otherMyClass and return true or false}
if中的代码不是有问题吗,因为它将为o1.equals(
有没有什么设计模式(或习惯用法)可以帮助在Java语言中实现equals()方法?我选择的方法是:generate equals() method in Eclipse,但是...我找到了一个很好的方法(用AbstractList)来使生成的代码更好:
if (!other.attributes==null : attributes.equal