Shouldn't HashSet/Map use Arrays.hashCode(x) ?
martinrb at google.com
Fri Jun 4 11:26:34 PDT 2010
Aside from the fact that it would be a hugely incompatible change
to change the hashing/equality algorithm now,
it is quite a religious argument about which is the Right Thing to do.
Here's some religion/philosophy for you:
There are some existing collections, e.g. BlockingQueues,
that use identity comparison instead of content comparison.
On Fri, Jun 4, 2010 at 08:49, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
> Otherwise e.g. int as key for HashSet/Map doesn't make any sense.
> I use a class where the content of an int defines the uniqueness or there
> Before I create a new instance, I have to check if there is just one for the
> same int content.
> Using the current HashSet/Map implementation does not serve this need.
> It seems, that I should first instantiate a temporary object containing the
> int, hash it in the set/map, and later throw it away. :-(
> Maybe another reason for solving
More information about the core-libs-dev