equals() perfect 하게 사용하기

| | Comments (0) | TrackBacks (0)
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);
    }


0 TrackBacks

Listed below are links to blogs that reference this entry: equals() perfect 하게 사용하기 .

TrackBack URL for this entry: http://dongchimi.unfix.net/mt/mt-tb.cgi/35

Leave a comment

Recent Comments

Sign In

About this Entry

This page contains a single entry by 동치미 published on August 6, 2008 2:11 PM.

토드 단축키 모음 by 김기사 was the previous entry in this blog.

JavaScript 관련 Favorate Site 모음 is the next entry in this blog.

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