Re: Recent tidying of alt.design

2004-01-03 Thread Glen Mazza
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" <[EMAIL PROTECTED]> 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
> 
> 


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


Recent tidying of alt.design

2004-01-03 Thread Peter B. West
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