LinkedList: toArray(T[] a) : LinkedList « java.util « Java by API






LinkedList: toArray(T[] a)

 
import java.util.LinkedList;
import java.util.List;

public class Main {

  public static void main(String[] args) {

    List<String> theList = new LinkedList<String>();
    theList.add("A");
    theList.add("B");
    theList.add("C");
    theList.add("D");

    String[] my = theList.toArray(new String[0]);

    for (int i = 0; i < my.length; i++) {
      System.out.println(my[i]);
    }
  }
}

   
  








Related examples in the same category

1.new LinkedList < E > ()
2.LinkedList: add(E o)
3.LinkedList: add(int index, E element)
4.LinkedList: addFirst(E o)
5.LinkedList: addLast(E o)
6.LinkedList: clear()
7.LinkedList: get(int index)
8.LinkedList: getFirst()
9.LinkedList: getLast()
10.LinkedList: indexOf(Object o)
11.LinkedList: iterator()
12.LinkedList: lastIndexOf(Object o)
13.LinkedList: remove(int index)
14.LinkedList: remove(Object o)
15.LinkedList: removeFirst()
16.LinkedList: removeLast()
17.LinkedList: set(int index, E element)
18.LinkedList: subList(int fromIndex, int toIndex)