Java List.toArray()
Syntax
List.toArray() has the following syntax.
Object [] toArray()
Example
In the following code shows how to use List.toArray() method.
import java.util.Arrays;
import java.util.List;
/* www. j a va2s . c o m*/
public class Main {
public static void main(String args[]) {
String[] a = new String[] { "a", "c", "b" };
List<String> l = (Arrays.asList());
String stuff[] = (String[]) l.toArray();
}
}
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »