Name: rmT116609 Date: 04/14/2004
A DESCRIPTION OF THE PROBLEM :
The API Javadoc for Collection toArray() does not specify empty collection behavior. Since the List API Javadoc references the Collection Javadoc, this should be mentioned.
The Javadoc states that it "Returns an array containing all of the elements in this collection." However, the observed behavior seems that if a Collection (or, in my case, a List) is empty, it returns null.
I'd hope the Javadoc should mention null, empty array, or explicitly undefined
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I'd hope the Javadoc should mention null, empty array, or explicitly undefined behavior for an empty collection or list
ACTUAL -
The Javadoc states that it "Returns an array containing all of the elements in this collection." However, the observed behavior seems that if a Collection (or, in my case, a List) is empty, it returns null.
URL OF FAULTY DOCUMENTATION :
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html#toArray()
(Incident Review ID: 250281)
======================================================================