The HashMap putAll and putAllInternal (called from constructor) methods use size() to get the size of the map to be added, and then iterate over the iterator that many times to add elements. Instead, they should call hasNext() on the iterator.
Attached is a patch to HashMap and Hashtable to fix this issue.
I gave up on trying to fix it for "all" classes when I noticed that ArrayList was actually doing meaningful optimization based on the returned size. It would probably still be worth testing Sun's implementation of all the *List and *Set classes, and Vector, to see how they cope with an inaccurate return from size().
If someone would test and apply this patch, I'd be extremely grateful. (my paperwork was completed years ago, in case it matters - this patch is probably too small to care, anyway). The patch is untested as I've never been able to successfully build Classpath from source.
Thanks, Stuart.
-- Stuart Ballard, Senior Web Developer FASTNET - Web Solutions (215) 283-2300, ext. 126 www.fast.net
_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath

