List<String> nameList = ...    
String result = nameList.stream().collect(Collectors.joining("','", "'", "'"));
Answer from Igorock on Stack Overflow
🌐
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.
🌐
Bitcompiler
tutorials.bitcompiler.com › 2024 › 03 › how-to-convert-list-of-strings-to-comma.html
How to convert a List of Strings to a Comma Separated String with Single Quotes In Java
This Java code uses Java Streams to map each element of the list to a string with single quotes around it using the map operation. Then, it collects these strings into a single comma-separated string using the Collectors.joining method.
🌐
Medium
medium.com › @as.vignesh › append-quotes-to-strings-in-an-array-and-make-it-comma-separated-string-in-java-5dbb9edccaa8
Append quotes to strings in an array and make it comma ...
Open in app · Sign up · Sign in · Write · PAGE NOT FOUND · Out of nothing, something · You can find (just about) anything on Medium — apparently even a page that doesn’t exist. Maybe these stories will take you somewhere new · A fascinating variety of Irish facts, brought to you ...
🌐
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 - delimiter: The string used to separate elements (, in this case) ... import java.util.*; public class GFG { public static void main(String args[]) { List<String> list = new ArrayList<>(Arrays.asList("Geeks", "ForGeeks", "GeeksForGeeks")); System.out.println("List of String: " + list); String result = String.join(",", list); System.out.println("Comma separated String: " + result); } }
🌐
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 - 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.
🌐
Medium
medium.com › @alxkm › converting-a-list-of-strings-to-a-comma-separated-string-in-java-multiple-approaches-ebb86745c889
Java Interview: Converting a List of Strings to a Comma-Separated String in Java: Multiple Approaches | by Alex Klimenko | Medium
August 9, 2025 - StringBuilder sb = new StringBuilder(); for (int i = 0; i < names.size(); i++) { sb.append(names.get(i)); if (i < names.size() - 1) { sb.append(","); } } String result = sb.toString(); System.out.println(result); // Output: Alice,Bob,Charlie · Works in all Java versions.
Find elsewhere
🌐
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
June 29, 2016 - 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", "London", "New York", "San Francisco"); String expected = "Milan,London,New York,San Francisco"; assertEquals(expected, toCs
🌐
Java67
java67.com › 2018 › 10 › how-to-convert-list-or-set-of-string-to-comma-separated-string-in-java-csv.html
How to Convert a List of String to Comma Separated String (CSV) in Java 8? Example | Java67
There are many ways to complete this task, but as I said, prefer String.join() if you are using Java 8 or higher version. You can also change the delimiter to any character or String you want. For example, if your String is separated by a colon instead of a comma, then you can just use a colon, and it will work like this.
🌐
TutorialsPoint
tutorialspoint.com › article › java-program-to-convert-a-list-of-string-to-comma-separated-string
Java program to convert a list of string to comma separated string
August 26, 2025 - In Java 8 and later, we can use the method Collectors.joining() from the Streams API to convert a list of strings to a comma-separated string.
🌐
Attacomsian
attacomsian.com › blog › java-convert-list-to-comma-separated-string
Convert a list to a comma-separated string in Java
October 29, 2022 - You can use core Java functions, Steams API, and Apache Commons Lang to convert a list into a string. The most common way to convert a list of strings into a comma-separated string is by using the static join() method from the String class:
🌐
Reverse Coding
reversecoding.net › java-8-convert-list-string-comma
Java 8 - Convert List to String comma separated | Reverse Coding
May 22, 2016 - 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 · As you can see it’s much more ver
🌐
Coderanch
coderanch.com › t › 433460 › java › Convert-List-comma-delimited-string
Convert List to comma delimited string (Beginning Java forum at Coderanch)
The only way I see to do it is either with the Iterator above, or with a foreach and getting rid of the comma at the end of the string after you exit the loop. Is there a similar way to do this in a foreach loop?