25,985
社区成员
发帖
与我相关
我的任务
分享
public boolean equals(Object obj) {
if(this == obj)//this是什么。obj又是哪一个的对象?
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
Order other = (Order)obj;
if(id == null){
if(other.id != null)
return false;
}else if(!id.equals(other.id))
return false;
return true;
}
public int hashCode() {
final int prime = 31;//prime是什么意思为什么为31;
int result = 1;//result为什么赋值为1
result = prime*result +((id == null)?0:id.hashCode());
return result;
}