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 ?
๐ŸŒ
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.
๐ŸŒ
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.
๐ŸŒ
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); } } }
๐ŸŒ
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");
๐ŸŒ
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.
๐ŸŒ
Reddit
reddit.com โ€บ r/javahelp โ€บ returning arraylist for string of arrays
r/javahelp on Reddit: Returning ArrayList for string of Arrays
September 26, 2019 -

Given an array of Strings, return an ArrayList containing the same Strings in * the same order array2List( {"Apple", "Orange", "Banana"} ) -> ["Apple", * "Orange", "Banana"] array2List( {"Red", "Orange", "Yellow"} ) -> ["Red", * "Orange", "Yellow"] array2List( {"Left", "Right", "Forward", "Back"} ) -> * ["Left", "Right", "Forward", "Back"] */ public List<String> array2List(String[] stringArray){

	return null;

}

I'm not quite understanding the question. Do I have to create a new array with these items and then do an arrayList, or am I just all turned around? This is whats (embarrassingly) throwing me off:

public List<String> array2List(String[] stringArray)

Any help or an explanation would help. I'm just beginning Java and feel a bit overwhelmed with everything. I've read over and over again about arrayLists, and am just stuck. Thank you for your consideration!