In Java 8 or later:
String listString = String.join(", ", list);
In case the list is not of type String, a joining collector can be used:
String listString = list.stream().map(Object::toString)
.collect(Collectors.joining(", "));
Answer from Vitalii Fedorenko on Stack Overflow Top answer 1 of 16
1239
In Java 8 or later:
String listString = String.join(", ", list);
In case the list is not of type String, a joining collector can be used:
String listString = list.stream().map(Object::toString)
.collect(Collectors.joining(", "));
2 of 16
425
If you happen to be doing this on Android, there is a nice utility for this called TextUtils which has a .join(String delimiter, Iterable) method.
List<String> list = new ArrayList<String>();
list.add("Item 1");
list.add("Item 2");
String joined = TextUtils.join(", ", list);
Obviously not much use outside of Android, but figured I'd add it to this thread...
Programiz
programiz.com › java-programming › library › arraylist › tostring
Java ArrayList toString() | Programiz
March 12, 2024 - The Java ArrayList toString() method converts an arraylist into a String.
Converting ArrayList of String to a simple 'String[]' array in ...
Java: Convert Array to ArrayList, and ...
Filling an ArrayList of type String with Strings
10:57
How To Convert String To An Array In Java | Java Full Course From ...
02:59
How to convert arraylist to array in java | List to array conversion ...
09:40
Learn Java arraylists in 9 minutes! 📃 - YouTube
Coderanch
coderanch.com › t › 377381 › java › convert-ArrayList-Strings-String
convert an ArrayList of Strings into String[] ? (Java in General forum at Coderanch)
July 31, 2005 - 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.
Dot Net Perls
dotnetperls.com › convert-arraylist-string-java
Java - Convert ArrayList to String - Dot Net Perls
Then We use String.join to convert the ArrayList into a single string. We use a comma delimiter. Result The ArrayList's contents are now represented in a string with comma character delimiters. import java.util.ArrayList; public class Program { public static void main(String[] args) { // Create ...
Edureka Community
edureka.co › home › community › categories › java › how can i convert an arraylist string to ...
How can I convert an ArrayList String to String in Java | Edureka Community
April 20, 2018 - I am using the toArray() method, but it is returning an object array rather than a string array
GeeksforGeeks
geeksforgeeks.org › java › convert-a-string-to-a-list-of-characters-in-java
Convert a String to a List of Characters in Java - GeeksforGeeks
September 2, 2026 - Create an empty ArrayList. Traverse the String using a loop. Get each character using charAt(). Add the character to the List. ... import java.util.ArrayList; import java.util.List; class StringToListLoop { public static void main(String[] args) ...
GeeksforGeeks
geeksforgeeks.org › java › how-to-convert-a-string-to-arraylist-in-java
How to Convert a String to ArrayList in Java? - GeeksforGeeks
July 23, 2025 - Converting String to ArrayList means each character of the string is added as a separator character element in the ArrayList.
Baeldung
baeldung.com › home › java › java string › convert a comma separated string to a list in java
Convert a Comma Separated String to a List in Java
September 3, 2025 - The split method we used to split our string of integers (ranks) uses zero as the limit, and so it ignores the empty strings, whereas the split used on the countries string retains empty strings in the returned array. Now, we’ll implement the same conversions using the Java Stream API.
BeginnersBook
beginnersbook.com › 2015 › 05 › java-string-to-arraylist-conversion
Java – How to Convert a String to ArrayList
September 20, 2022 - We are splitting the string based on comma (,) as delimiter to get substrings. These substrings are assigned to ArrayList as elements. import java.util.ArrayList; import java.util.List; import java.util.Arrays; public class JavaExample { public static void main(String args[]){ String num = "22,33,44,55,66,77"; String str[] = num.split(","); List<String> al = new ArrayList<String>(); al = Arrays.asList(str); for(String s: al){ System.out.println(s); } } }
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › ArrayList.html
ArrayList (Java Platform SE 8 )
July 21, 2026 - Java™ Platform Standard Ed. 8 ... public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, Serializable · Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list.
Coderanch
coderanch.com › t › 40 › 379449 › java › String-array-arraylist
String array to arraylist (Java in General forum at Coderanch)
June 7, 2012 - ... Janarthan S Sathiamurthy wrote:import java.util.Collections; List myList = new ArrayList(); String[] myStringArray = new String[] {"Java", "is", "Cool"}; Collections.addAll(myList, myStringArray); After this code, 'myList' should contain all the elements from the array.
College Board
apcentral.collegeboard.org › media › pdf › ap-computer-science-a-java-quick-reference.pdf pdf
___________________________________________________ AP ® Computer Science A
This table contains accessible methods from the Java library that may be included on the AP Computer Science A Exam. Class Constructors and Methods · Explanation · String Class · String(String str) Constructs a new String object that represents the same sequence of · characters as str · int length() Returns the number of characters in a String object · String substring(int from, int to) Returns the substring beginning at index from and ending at index ·
BeginnersBook
beginnersbook.com › 2013 › 12 › how-to-convert-arraylist-to-string-array-in-java
How to convert ArrayList to string array in java
We are converting this arraylist ... names.add("Harsh"); names.add("John"); // ArrayList to Array Conversion using toArray() String arr[]=names.toArray(new String[names.size()]); //Print array elements for(String str: arr) { System.out.println(str); } } }...
TutorialsPoint
tutorialspoint.com › article › convert-an-arraylist-of-string-to-a-string-array-in-java
Convert an ArrayList of String to a String array in Java
September 25, 2019 - 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); } } }