classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [really patch] Re: HashMap putAll/putAllInternal bug


From: Brian Jones
Subject: Re: [really patch] Re: HashMap putAll/putAllInternal bug
Date: 30 Sep 2003 01:23:13 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Stuart Ballard <address@hidden> writes:

> Bryce McKinlay wrote:
> > size() is used here because, obviously, it is generally more
> > efficient to call it once rather than calling hasNext() many
> > times. I believe that the current implementation is within spec
> > according to the collections documentation. If your collections are
> > returning an inaccurate size() then I'd argue they are not valid
> > implementations of Map.
> 
> Sure: as I noted, my argument is that Sun's implementation can handle
> such invalid implementations of Map, so people might rely on it, as I
> did.

Before we've said we preferred correctness over optimization every
time and it is well known that optimizing too early can reduce the
effectiveness of certain JVM implementations that will do it for you.
Perhaps using an Iterator and hasNext() with no reliance on size() is
better all around and just leave optimization to the VM?

Brian
-- 
Brian Jones <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]