Convert ArrayList to String[] in Java

List<String> list = ..;
String[] array = list.toArray(new String[0]);

For example:

List<String> list = new ArrayList<String>();
//add some stuff
list.add("android");
list.add("apple");
String[] stringArray = list.toArray(new String[0]);

References
https://stackoverflow.com/questions/4042434/converting-arrayliststring-to-string-in-java

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.