c.toArray might (incorrectly) not return Object[] (see 6260652)
David Holmes - Sun Microsystems
David.Holmes at Sun.COM
Fri May 22 02:05:49 UTC 2009
Florian Weimer said the following on 05/22/09 03:18:
> So says the ArrayList(Collection) constructor. Can this bug report be
> opened? Is this workaround still necessary?
I'm confused. The bug states:
The Collection documentation claims that
collection.toArray()
is "identical in function" to
collection.toArray(new Object[0]);
but I checked the Collection documentation back to 1.4.2 and it doesn't
say anything like that as far as I can see.
But as far as I can tell from the code the implementation is unchanged.
toArray() will "clone" the internal array and so if you really want
Object[] you have use toArray(someObjectArray)
HTH
David Holmes
More information about the core-libs-dev
mailing list