Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B76DEC479 for ; Fri, 4 May 2012 13:39:09 +0000 (UTC) Received: (qmail 13252 invoked by uid 500); 4 May 2012 13:39:09 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 13173 invoked by uid 500); 4 May 2012 13:39:09 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 13165 invoked by uid 99); 4 May 2012 13:39:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 May 2012 13:39:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 May 2012 13:39:08 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 5046F43061C for ; Fri, 4 May 2012 13:38:48 +0000 (UTC) Date: Fri, 4 May 2012 13:38:48 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: <2136535775.26940.1336138728330.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1629638549.26933.1336138368267.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (MATH-786) "hashCode" in "Pair" class MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MATH-786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13268358#comment-13268358 ] Gilles commented on MATH-786: ----------------------------- I already notice a problem with this proposal: the elements of the pair might well be mutable, and since we store references, not copies, of the objects passed to the constructor, we cannot ensure that "equals" will stay consistent with the cached "hashCode"! Does someone see a way to make "Pair" truly immutable? > "hashCode" in "Pair" class > -------------------------- > > Key: MATH-786 > URL: https://issues.apache.org/jira/browse/MATH-786 > Project: Commons Math > Issue Type: Improvement > Affects Versions: 3.0 > Reporter: Gilles > Assignee: Gilles > Priority: Trivial > Fix For: 3.1 > > > Since "Pair" is supposed to be an immutable class, couldn't we cache the "hashCode" value at construction? That would supposedly make it more efficient when used in maps. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira