aspose file tools
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
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: How to convert java.util.List to Array?.
 
Similar Threads
fundamentals
Node to int??
how to convert html to wml
how to convert Byte to the String
In Axis, how to support java.util.List types ?