commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (MATH-786) "hashCode" in "Pair" class
Date Sun, 06 May 2012 11:13:48 GMT


Gilles commented on MATH-786:

Can we ensure there all applications, where one would mutate the underlying "key", will behave
badly, even if the hash code is recomputed every time?

If not, the proposal makes the class more flexible.
Of course the default value of the flag will be "true".

The point is that we don't have to force the user to "obey the Javadoc"; we can provide both
possibilities and they have to use the chosen one consistently (or "bad things happen" etc.).

> "hashCode" in "Pair" class
> --------------------------
>                 Key: MATH-786
>                 URL:
>             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:!default.jspa
For more information on JIRA, see:


View raw message