Patch: java.util.Hashtable, java.util.HashMap

Bryce McKinlay bryce@albatross.co.nz
Sun Dec 17 00:50:00 GMT 2000


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 ]




More information about the Java-patches mailing list