This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How to convert java.util.List to Array?. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How to convert java.util.List to Array?." Watch "How to convert java.util.List to Array?." New topic
Author

How to convert java.util.List to Array?.

Krish Pinnamaneni
Greenhorn

Joined: Mar 16, 2005
Posts: 22
Hi,
Can any body help me how to convert java.util.List a1 = new ArrayList();
to Object[] .
In Advance,
Thanks,
Krish
Nischal Tanna
Ranch Hand

Joined: Aug 19, 2003
Posts: 182
use toArray() method to get the Object[] out of it

a1.toArray();


Thnx
Poobhathy Kannan
Ranch Hand

Joined: May 26, 2004
Posts: 94
Check the java api doc

Object[] toArray()
Returns an array containing all of the elements in this list in proper sequence.

Object[] toArray(Object[] a)
Returns an array containing all of the elements in this list in proper sequence; the runtime type of the returned array is that of the specified array.


http://learnertobeginner.blogspot.com/
Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485
what about the returned type of the array for the first method

object toArray()
{
}
Animesh Shrivastava
Ranch Hand

Joined: Jul 19, 2004
Posts: 298
Look at this post,
toArray
 
 
subject: How to convert java.util.List to Array?.
 
Similar Threads
how to convert Byte to the String
In Axis, how to support java.util.List types ?
fundamentals
Node to int??
how to convert html to wml