在Eclipse中,右键单击->源->生成hashCode(),然后equals()给出以下信息:
@Overridepublic int hashCode() { final int prime = 31; int result = 1; result = prime * result + (pre == null ? 0 : pre.hashCode()); return result;}@Overridepublic boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Emp)) return false; Emp other = (Emp) obj; return pre == null ? other.pre == null : pre.equals(other.pre);}
我已选择代码作为唯一字段
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)