This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Re: Patch: java.util.Hashtable, java.util.HashMap
- To: Jeff Sturm <jsturm at detroit dot appnet dot com>
- Subject: Re: Patch: java.util.Hashtable, java.util.HashMap
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Sun, 17 Dec 2000 21:51:35 +1300
- CC: java-patches at sources dot redhat dot com
- References: <3A3C6618.C61531C3@detroit.appnet.com>
Jeff Sturm wrote:
> The rehash() method will corrupt a Hashtable during put() if the bucket
> isn't empty. The reason is that `idx' is recomputed after rehash(), but
> not `last'.
>
> A simple fix is elimination of the `last' variable, since it is as
> equally correct to link to the head of the list as to the tail.
>
> The fix applies identically to Hashtable and HashMap.
>
> 2000-11-17 Jeff Sturm <jeff.sturm@commerceone.com>
>
> * java/util/Hashtable.java (put): Remove `last' variable.
> Link new entry to head of list.
> * java/util/HashMap.java (put): Ditto.
Thanks, Jeff. I'm going to check this in.
regards
[ bryce ]