----- Original Message ----- From: "James Strachan" <[EMAIL PROTECTED]> To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]> Sent: Wednesday, March 20, 2002 12:56 AM Subject: Re: [COLLECTIONS] [VOTE] Release Collections 2.0
> [snip] > > I just thought Morgan was thinking of removing the reflection code and just > using Object[] instead and just wanted to explain why the reflection was > needed - though I think I got the wrong end of the stick and Morgan was > really just talking about tuning the Object[] use case while still > supporting reflection for non-Object[] types. > > Sorry for the confusion everyone... > No problem. I already patched ArrayIterator.next(), but I decided not to apply it: // don't use reflection for Object arrays if (array instanceof Object[]) { return ((Object[]) array)[index++]; } // use reflection for primitive arrays return Array.get( array, index++ ); It works fine, but it seems like premature optimization now. I can't tell for sure (Array.get(Object,int) is a native method), but surely the Collections method performs the same optimization internally. Anything else seems silly. - Morgan _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>