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);
    }


Sign In

About this Archive

Find recent content on the main index or look in the archives to find all content.