1: public class S581 { 2: …… 3: // 자신의 객체와 비교하는 equals() 구현 4: public boolean equals(Object obj) { 5: boolean ret; 6: if (obj != null) { 7: int i1 = this.hashCode(); 8: int i2 = obj.hashCode(); 9: if (i1 == i2) { ret = true; } 10: else { ret = false; } 11: } else { 12: ret = false; 13: } 14: return ret; 15: } 16: // hashCode() 구현 17: public int hashCode() { 18: return new HashCodeBuilder(17, 37).toHashCode(); 19: } 20: …… 21: }