You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Leo Li <li...@gmail.com> on 2006/09/18 03:32:49 UTC

[classlib][luni][HashMap]Avoid to expand data array in HashMap.putAll more than once.

Hi, all:
     Current implementation of HashMap.putAll() in Harmony just calls
super.putAll() which ultimately will call HashMap.put(), while this way
might lead to expand the backing data array more than once if the elements
in the added Map is sufficiently large. However, the situation is able to
be avoided, since we actually know the size of the added Map, thus the
expected HashMap capacity.
     If no one objects, I will add an expected capacity argument in internal
rehash() method as rehash(int expectedCapacity) and rewrite  the
HashMap.putAll().

    Good luck!

-- 
Leo Li
China Software Development Lab, IBM

Re: [classlib][luni][HashMap]Avoid to expand data array in HashMap.putAll more than once.

Posted by Tim Ellison <t....@gmail.com>.
Go for it.

Tim

Leo Li wrote:
> Hi, all:
>     Current implementation of HashMap.putAll() in Harmony just calls
> super.putAll() which ultimately will call HashMap.put(), while this way
> might lead to expand the backing data array more than once if the elements
> in the added Map is sufficiently large. However, the situation is able to
> be avoided, since we actually know the size of the added Map, thus the
> expected HashMap capacity.
>     If no one objects, I will add an expected capacity argument in internal
> rehash() method as rehash(int expectedCapacity) and rewrite  the
> HashMap.putAll().
> 
>    Good luck!
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org