August 2008 Archives
List의 contains 메소드를 사용할 일이 있어서 equals() 메소드에 대하여 찾다가 다음과 같은 나이스 사용 예제를 찾게 되었다. 책에다 있는 내용이니궁금한점은 책을 찾다보도록 하자.
public boolean equals(Object otherObject){
if (this == otherObject )
return true;
if (otherObject == null)
return false;
if (getClass() != otherObject.getClass())
return false;
CareCustomer careCustomer = (CareCustomer) otherObject;
return (careCustomerId == careCustomer.careCustomerId
&& customerId == careCustomer.customerId);
}
public boolean equals(Object otherObject){
if (this == otherObject )
return true;
if (otherObject == null)
return false;
if (getClass() != otherObject.getClass())
return false;
CareCustomer careCustomer = (CareCustomer) otherObject;
return (careCustomerId == careCustomer.careCustomerId
&& customerId == careCustomer.customerId);
}
Recent Comments
emre on equals() perfect 하게 사용하기 : thank you
동치미 on 오브젝트와 오브젝트 타입, 그리고 클래스: 에~ 시간이 없어서
동치미 on WP의 부활: //드루지기 안녕하
드루지기 on WP의 부활: 워드프레스 좋지요.
동치미 on 느림의 미학: [민달이] 감사합니
민달이 on 느림의 미학: 저도 여유를 가지자
동치미 on 철학을가진개발자 Vs 그렇지않은개발자: [데꾸벅] 막걸리
동치미 on 근황!: //kimgisa
kimgisa on 근황!: Email 주소 안