Returns an array containing all the elements in the collection.
toArray()
Returns a new array that contains all elements in the collection.
Syntax
Java
public Object[] toArray ()
Return Value
Type: An array of Object elements. A new array that contains all elements in the collection.
toArray(T\[\] a)
Returns an array containing all the elements in the collection.
Syntax
Java
publicfinal <T> T[] toArray (
T[] a
)
Parameters
a
Type: An element array.
An array to store the elements in this collection in if there is room.
Return Value
Type: An element array. a containing the elements in this collection if there was room, elements at unused positions
are set to null, or a new array that contains all elements in the collection.
This element is not available using the selected API.
In this article
By accessing the information on this site you accept our
terms and conditions and
privacy policy.
This site uses cookies to enhance your experience and provide additional functionality.