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]);

The toArray() method without passing any argument returns Object[]. So you have to pass an array as an argument, which will be filled with the data from the list, and returned. You can pass an empty array as well, but you can also pass an array with the desired size.

Important update: Originally the code above used new String[list.size()]. However, this blogpost reveals that due to JVM optimizations, using new String[0] is better now.

Answer from Bozho on Stack Overflow
🌐
W3Schools
w3schools.com › java › java_arraylist.asp
Java ArrayList
Elements in an ArrayList are actually objects. In the examples above, we created elements (objects) of type "String". Remember that a String in Java is an object (not a primitive type). To use other types, such as int, you must specify an equivalent wrapper class: Integer.
🌐
Vultr Docs
docs.vultr.com › java › examples › convert-the-arraylist-into-a-string-and-vice-versa
Java Program to Convert the ArrayList into a string and vice versa | Vultr Docs
December 19, 2024 - The output would be [Java, Python, C++]. Realize the need for a string without brackets or commas for some applications. Iterate through the ArrayList elements to construct a custom formatted string.
🌐
Javatpoint
javatpoint.com › convert-arraylist-to-string-array-in-java
Convert ArrayList to String Array in Java - Javatpoint
Convert ArrayList to String Array in Java with java tutorial, features, history, variables, object, programs, operators, oops concept, array, string, map, math, methods, examples etc.
🌐
Programiz
programiz.com › java-programming › examples › arraylist-string-conversion
Java Program to Convert the ArrayList into a string and vice versa
import java.util.ArrayList; class ...rintln("ArrayList: " + languages); // convert the arraylist into a string String arraylist = String.join(", ", languages); System.out.println("String: " + arraylist); } } ... In the above example, we have used the join() method of the String ...
Find elsewhere
🌐
Sentry
sentry.io › sentry answers › java › create arraylist from array in java
Create ArrayList from array in Java | Sentry
The easiest way to convert to an ArrayList is to use the built-in method in the Java Arrays library: Arrays.asList(array). This method will take in a standard array and wrap it in the AbstractList class, exposing all the methods available to ...
🌐
Java67
java67.com › 2012 › 09 › java-program-to-convert-string-arraylist-to-string-array.html
How to convert an ArrayList to Array in Java? Example | Java67
By the way from Java 8 onwards, you can also use Stream class to convert ArrayList to array in Java as shown in this example here. List of Java homework exercise program from java67 blog · Write a Java program to find Square root of a number · Write a Java program to check if number is Armstrong or not ... Thanks for article. One question: if each element into objMnt is really a Object reference to String instance ( and I can make a downcast such String e = (String)objMnt[0] ) Why I cannot make a downcast String[] a = (String[]) objMnt ?
🌐
Coderanch
coderanch.com › t › 377381 › java › convert-ArrayList-Strings-String
convert an ArrayList of Strings into String[] ? (Java in General forum at Coderanch)
ArrayList aL = getStringObj(); But "aL.toArray();" can only return me an array of Objects ? Of course, I can do Iterator i = aL.iterator(); String s = new String[aL.size()]; int i = 0; while(i.hasNext()) { s[i++] = i.next().toString(); } return s; where "s" is an array of Strings.
🌐
Codecademy
codecademy.com › docs › java › arraylist › .toarray()
Java | ArrayList | .toArray() | Codecademy
January 5, 2024 - The following syntax is used when an ArrayList of type T is converted into an array that returns another array of type T: ... Here, array is the resulting array after conversion. In the example below, the .toArray() method is used to convert ...
🌐
Vultr
docs.vultr.com › java › standard-library › java › util › ArrayList › toString
Java ArrayList toString() - Convert To String | Vultr Docs
November 19, 2024 - The toString() method in Java's ArrayList class is a convenient way to convert the entire contents of the ArrayList into a single String.
🌐
Baeldung
baeldung.com › home › java › java array › how to add string arrays to arraylist in java
How to Add String Arrays to ArrayList in Java | Baeldung
March 7, 2025 - List<String> initLanguageList() { List<String> languageList = new ArrayList<>(); languageList.add("Languages"); languageList.add(":"); return languageList; } If we correctly add String elements from the three arrays in turn to the List that initLanguageList() produced, we expect to have a List carrying the following elements: final static List<String> EXPECTED = List.of( "Languages", ":", "Java", "Kotlin", "Sql", "Javascript", "C", "C++", "C#", "Typescript", "Python", "Ruby", "Go", "Rust");
🌐
TutorialsPoint
tutorialspoint.com › convert-an-arraylist-of-string-to-a-string-array-in-java
Convert an ArrayList of String to a String array in Java
import java.util.*; public class Demo { public static void main(String[] args) { ArrayList<String> arrList = new ArrayList<String>(); arrList.add("Bentley"); arrList.add("Audi"); arrList.add("Jaguar"); arrList.add("Cadillac"); arrList.add("Mazda"); arrList.add("Land Rover"); arrList.add("Porsche"); int size = arrList.size(); String res[] = arrList.toArray(new String[size]); System.out.println("String Array..."); for(String s: res) { System.out.println(s); } } }
🌐
BeginnersBook
beginnersbook.com › 2013 › 12 › how-to-convert-arraylist-to-string-array-in-java
How to convert ArrayList to string array in java
Steps followed in this program are: 1. Create an array with the same size as the arraylist. The arraylist size can be found using size() method of ArrayList class. The statement String arr[] = new String[arrList.size()]; creates an array arr of string type with the same size as of arrList.
🌐
GeeksforGeeks
geeksforgeeks.org › java › convert-list-to-array-in-java
Convert List to Array in Java - GeeksforGeeks
July 11, 2025 - Since List preserves the insertion order, it allows positional access and insertion of elements. Now here we are given a List be it any LinkedList or ArrayList of strings, our motive is to convert this list to an array of strings in Java using different methods.
🌐
Baeldung
baeldung.com › home › java › java string › convert an arraylist of string to a string array in java
Convert an ArrayList of String to a String Array in Java | Baeldung
March 7, 2025 - One straightforward idea to solve our problem is to walk through the string ArrayList, take every element, and fill a predeclared string array.
🌐
BeginnersBook -
beginnersbook.com › home › java › java – how to convert a string to arraylist
Java – How to Convert a String to ArrayList
September 20, 2022 - Input: 22,33,44,55,66,77 Delimiter: ... 3 elements {“Welcome”, “to”, “BeginnersBook”} ... 1) First split the string using String split() method and assign the substrings into an array of strings....