本文共 632 字,大约阅读时间需要 2 分钟。
public boolean equals(Object other) { if (this == other) return true; if (!(other instanceof User)) return false; final User u = (User)other; if (! name.equals(u.getName())) return false; if (!birthday.equals(u.getBirthday())) return false; if (!(age==u.age)) return false; if(! gender.equals(u.gender)) return false; return true; }
public int hashCode() { int result; result = name.hashCode(); result = 29 * result + getBirthday().hashCode(); return result; }
转载地址:http://vstki.baihongyu.com/