Hi,

In several publications/documents I have seen the suggestion that hash codes
should be calculated once and cached for subsequent use...

    public int hashCode() {
        if (cachedHashCode == NOT_SET) {
            StringBuffer s = new StringBuffer();
            s.append(name);
            s.append(DELIMITER);
            s.append(testDate);
            cachedHashCode = s.hashCode();
        }

        return cachedHashCode;
    }

However, due to the fact that the primary key values are public (and thus
can be changed at any time without an instance's knowledge) isn't the idea
of keeping a cached hash code value a bad idea?

Thanks,
Kirk
_____________________________________________

Kirk True
Software Engineer
paper2net.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to