You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Peter B. West" <pb...@powerup.com.au> on 2004/01/02 01:09:23 UTC

Recent tidying of alt.design

Recent minor changes to alt.design triggered by comments from John 
Austin.  In particular, John drew my attention to HashMap 
initialization.  I naively assumed that providing an initial size to a 
HashMap would take account of the default load factor.  Re-reading the 
documentation, I came to the conclusion (with John) that this was not 
the case.  That is, creating a hash with
   hm = new HashMap(20);
then adding 20 items to it, will force a rehash after 75% of the items 
have been added.  Silly as it seems, that appears to be the way of it. 
Does anyone else have any experience of this?

Peter
-- 
Peter B. West <http://www.powerup.com.au/~pbwest/resume.html>


Re: Recent tidying of alt.design

Posted by Glen Mazza <gr...@yahoo.com>.
I checked the API, what you describe below is just as
it states:

http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashMap.html

Its guidance on proper initial value and load factor
sizing may be of help for you.

Glen

--- "Peter B. West" <pb...@powerup.com.au> wrote:
> Recent minor changes to alt.design triggered by
> comments from John 
> Austin.  In particular, John drew my attention to
> HashMap 
> initialization.  I naively assumed that providing an
> initial size to a 
> HashMap would take account of the default load
> factor.  Re-reading the 
> documentation, I came to the conclusion (with John)
> that this was not 
> the case.  That is, creating a hash with
>    hm = new HashMap(20);
> then adding 20 items to it, will force a rehash
> after 75% of the items 
> have been added.  Silly as it seems, that appears to
> be the way of it. 
> Does anyone else have any experience of this?
> 
> Peter
> -- 
> Peter B. West
> <http://www.powerup.com.au/~pbwest/resume.html>
> 


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/