Package java.util
Class LinkedList
Description:
Returns an array that contains all the elements in this list in the correct order. The runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list. If the list fits the specified array with room to spare, the element in the array immediately following the end of the collection is set to null.
Example
LinkedList linkedList = new LinkedList();
linkedList.add("L");
linkedList.add("i");
linkedList.add("n");
linkedList.add("List");
linkedList.add("k");
linkedList.add("e");
linkedList.add("d");
Object[] arr = linkedList.toArray();
for (int i = 0; i < linkedList.size(); i++)
Logger.log("" + arr[i]);
The example above returns an array that contains the elements from the list.