Stuart Ballard <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to