Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-13-2007, 10:41 AM
Java Tip's Avatar
Moderator
 
Join Date: Nov 2007
Posts: 1,681
Rep Power: 4
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Default Converting ArrayList to Array
Sometimes you need to convert ArrayList to Array. This is simple using toArray method of ArrayList. Signature of toArray method is:

Code:
public Object[] toArray(Object[] a)
Example:
Code:
ArrayList listArray = new ArrayList();
		
listArray.add("Germany");
listArray.add("Holland");
listArray.add("Sweden");
		
String []strArray = new String[3];
listArray.toArray(strArray);
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting array to list and sorting it Java Tip java.lang 0 04-16-2008 10:36 PM
Converting an Array to a Vector Java Tip java.lang 0 04-14-2008 08:44 PM
Converting a Collection to an Array Java Tip java.lang 0 04-14-2008 08:44 PM
Arraylist to a 2- dimension array conversion mars123 New To Java 1 12-06-2007 11:24 AM
Array to ArrayList javaplus New To Java 2 11-12-2007 12:46 AM


All times are GMT +2. The time now is 01:55 AM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org