This is the mail archive of the java-patches@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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 ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]