Java examples for Collection Framework:LinkedList
Create an object array from elements of LinkedList
import java.util.LinkedList; public class Main { public static void main(String[] args) { LinkedList lList = new LinkedList(); /*from w ww .j ava 2 s. co m*/ //add elements to LinkedList lList.add("1"); lList.add("2"); lList.add("3"); lList.add("4"); lList.add("5"); Object[] objArray = lList.toArray(); System.out.println("Object array created from Java LinkedList."); System.out.println("Object array contains : "); for(int i=0; i<objArray.length ; i++) { System.out.println(objArray[i]); } } }