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
🌐
GeeksforGeeks
geeksforgeeks.org › java › convert-arraylist-to-comma-separated-string-in-java
Convert ArrayList to Comma Separated String in Java - GeeksforGeeks
July 23, 2025 - We can convert ArrayList to a comma-separated String using StringJoiner which is a class in java.util package which is used to construct a sequence of characters(strings) separated by a delimiter and optionally starting with a supplied prefix ...
🌐
Dot Net Perls
dotnetperls.com › convert-arraylist-string-java
Java - Convert ArrayList to String - Dot Net Perls
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 an ArrayList and add three strings to it. ArrayList<String> arr = new ArrayList<>(); arr.add("cat"); arr.add("dog"); arr.add("bird"); // Convert the ArrayList into a String.
🌐
Baeldung
baeldung.com › home › java › java string › convert a list to a comma-separated string
Convert a List to a Comma-Separated String | Baeldung
July 2, 2025 - You’ll see how recipes work, how to apply them across projects, and how to modernize code with confidence. Join the next session, bring your questions, and learn how to automate the kind of work that usually eats your sprint time. ... List conversion is still a hot topic as it’s something that we do very often as Java developers. In this tutorial, we’ll learn how to convert a List of String to a comma-separated String using four different approaches.
🌐
Java67
java67.com › 2012 › 10 › how-to-convert-arraylist-to-string-in-java-example.html
How to convert ArrayList to Comma Separated or Delimited String in Java - Spring Example | Java67
If you notice output, you will see delimiter semicolon at the end also, which is unnecessary. you can remove that using String's lastIndexOf() method or you can use traditional for loop and not append delimiter after last element. Having said that, I prefer Spring framework to deal with such common things. If possible always use library method like Spring to convert ArrayList to String in Java.
🌐
Medium
medium.com › @AlexanderObregon › turning-a-java-list-into-a-comma-separated-string-efc1b6c44d1b
Turning a Java List into a Comma-Separated String | Medium
June 20, 2025 - Learn how to turn a Java List into a comma-separated string using loops, StringBuilder, and String.join, with a close look at how each method works internally.
🌐
Vultr
docs.vultr.com › java › standard library › java › util › arraylist › tostring()
Java ArrayList toString() - Convert To String
November 19, 2024 - import java.util.ArrayList; ... [Red, Green, Blue]. The toString() method converts the ArrayList into a string representation with elements enclosed in square brackets and separated by commas....
Find elsewhere
🌐
Blogger
javarevisited.blogspot.com › 2022 › 12 › 6-ways-to-convert-arraylist-to-string.html
6 Ways to convert ArrayList to String in Java - Example Tutorial
September 14, 2023 - This is actually the best way to convert ArrayList to String because you don't need a third party library but problem is its only available from Java 8 and most of production code is still running on lower version. IF you are not using Apache commons library than its good time to add it into your build path. It provide several useful utility e.g methods to check if String is null or empty, converting list to array and others. It also provides a method to convert an ArrayList to comma separated String as shown below :
🌐
DZone
dzone.com › coding › java › convert a list to a comma-separated string in java 8
Convert a List to a Comma-Separated String in Java 8 - DZone
June 29, 2016 - Copy this class with all the implementations discussed and play with that. There is already a small test for each of them. package net.reversecoding.examples; import static java.util.stream.Collectors.joining; import static org.junit.Assert.assertEquals; import java.util.Arrays; import java.util.List; import org.junit.Test; public class CsvUtil { private static final String SEPARATOR = ","; public static String toCsv(List < String > listToConvert) { return String.join(SEPARATOR, listToConvert); } @Test public void toCsv_csvFromListOfString() { List < String > cities = Arrays.asList( "Milan", "
🌐
Simplesolution
simplesolution.dev › java-convert-arraylist-to-comma-separated-string
Java Convert ArrayList to Comma Separated String
In this Java core tutorial we learn how to convert a java.util.ArrayList object to a comma separated String in Java programming language. In Java, with a given ArrayList object we can use the String.join(CharSequence delimiter, Iterable<? extends CharSequence> elements) static method to convert it to a comma separated String value as the following example Java code.
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Java 8 - Converting a List to String with Examples - Java Code Geeks
July 5, 2021 - List.toString() is the simplest one but it adds the square brackets at the start and end with each string is separated with comma separator. The drawback is that we can not replace the comma with another separator and can not remove the square ...
🌐
Javacodeexamples
javacodeexamples.com › home
DIAMOND96 สล็อตเว็บตรง รองรับ True Wallet ถอนเงินได้จริง 100%
October 3, 2023 - DIAMOND96 เว็บสล็อตวอเลท รวมเกมสล็อตออนไลน์ ฝากถอนผ่าน True Wallet ระบบ Auto พร้อมทางเข้าเว็บหลักสำหรับมือถือ
🌐
GeeksforGeeks
geeksforgeeks.org › java › convert-a-list-of-string-to-a-comma-separated-string-in-java
Convert a List of String to a comma separated String in Java - GeeksforGeeks
January 23, 2026 - In Java, a List<String> can be efficiently converted into a comma-separated String using built-in utilities like String.join(), which concatenates list elements with a specified delimiter while ensuring clean, readable, and loop-free code.
🌐
CodingTechRoom
codingtechroom.com › question › -java-8-arraylist-to-comma-separated-string
How to Retrieve String Values from an ArrayList and Join Them into a Single Comma-Separated String in Java 8? - CodingTechRoom
How can I extract String values ... a single string using the Stream API. This process involves converting the List to a Stream and then using the `Collectors.joining()` method to concatenate the elements with a specified ...
🌐
Reverse Coding
reversecoding.net › java-8-convert-list-string-comma
Java 8 - Convert List to String comma separated | Reverse Coding
May 22, 2016 - For the old times’ sake, let’s have a look at Java 7 implementation. private static final String SEPARATOR = ","; public static void main(String[] args) { List<String> cities = Arrays.asList( "Milan", "London", "New York", "San Francisco"); StringBuilder csvBuilder = new StringBuilder(); for(String city : cities){ csvBuilder.append(city); csvBuilder.append(SEPARATOR); } String csv = csvBuilder.toString(); System.out.println(csv); //OUTPUT: Milan,London,New York,San Francisco, //Remove last comma csv = csv.substring(0, csv.length() - SEPARATOR.length()); System.out.println(csv); //OUTPUT: Milan,London,New York,San Francisco
🌐
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.
🌐
Techie Delight
techiedelight.com › home › java › convert a list to a string with separator in java
Convert a List to a String with Separator in Java | Techie Delight
July 7, 2026 - Since Java 8, you can use the String.join() method to join strings together using the specified separator. It only works on a List of type String.