Since Java 8:

String.join(",", slist);

From Apache Commons library:

import org.apache.commons.lang3.StringUtils

Use:

StringUtils.join(slist, ',');

Another similar question and answer here

Answer from BobTheBuilder on Stack Overflow
🌐
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.
Discussions

java - Convert List<String> to delimited String - Stack Overflow
Connect and share knowledge within a single location that is structured and easy to search. Learn more about Teams ... Closed 14 years ago. Possible Duplicate: Java: convert List to a join()d string More on stackoverflow.com
🌐 stackoverflow.com
November 15, 2011
Java- Converting a string of numbers separated by spaces into an array?
You have the right idea. String.split() will return an array of strings. Then, if you want to treat any individual string in that array as an integer you can use Integer.parseInt() . If you want to create an array of integers, just make the array that way. More on reddit.com
🌐 r/learnprogramming
7
4
February 2, 2016
how do I split a string into a list using multiple separators
You can use regular expression splitting, re.split: https://pythonexamples.org/python-split-string-by-regex/ More on reddit.com
🌐 r/learnpython
3
1
October 21, 2022
How to test a "\n" new line with junit 4
show us the entire assertEquals() command. What are you comparing. If you compare strings use the .equals() method like so: assert("\n".equals(someStringVariable)); or for assertEquals it is essentially calling .equals() on the two provided arguments. More on reddit.com
🌐 r/javahelp
5
15
October 19, 2020
🌐
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.
🌐
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.
🌐
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 - This tutorial demonstrates how to use streams in Java 8 and Java 7 to convert a list to a comma-separated string by manipulating the string before joining.
🌐
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.
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Java 8 - Converting a List to String with Examples - Java Code Geeks
July 5, 2021 - First, we will understand how to make List to String using toString() method. Next, Collection to String with comma separator or custom delimiter using Java 8 Streams Collectors api and String.join() method.
Find elsewhere
🌐
Sabe
sabe.io › blog › java-convert-list-comma-separated-string
How to Convert a List to Comma-Separated String in Java | Sabe
May 25, 2022 - Another way you can convert a string list to a comma-separated string is to use the collect() method on the Stream class. Basically the idea is to take the list and turn it into a stream, then join the stream using the separator you want.
🌐
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
🌐
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:
🌐
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.
🌐
Codemia
codemia.io › home › knowledge hub › best way to convert list to comma separated string in java
Best way to convert list to comma separated string in java | Codemia
July 31, 2025 - This is concise, readable, and directly expresses the intent: join these strings with this delimiter. If the list contains integers, domain objects, or values that need custom formatting, use a stream and map each element to a string first. ... 1import java.util.List; 2import java.util.stream.Collectors; 3 4public class Main { 5 public static void main(String[] args) { 6 List<Integer> numbers = List.of(1, 2, 3, 4); 7 8 String result = numbers.stream() 9 .map(String::valueOf) 10 .collect(Collectors.joining(", ")); 11 12 System.out.println(result); 13 } 14}
🌐
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 ...
🌐
javathinking
javathinking.com › blog › java-8-convert-list-to-string-with-separator
Java 8: Convert List to String with Separator — javathinking.com
Converting the list to a string with a separator allows you to present the data in a more organized way. When generating SQL queries dynamically, you may need to include a list of values in the IN clause. Converting the list to a comma-separated string can simplify the query construction process. import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class ListToStringExample { public static void main(String[] args) { // Create a list of strings List<String> stringList = Arrays.asList("apple", "banana", "cherry"); // Convert the list to a string with a comma separator String result = stringList.stream() .collect(Collectors.joining(", ")); // Print the result System.out.println(result); } }
🌐
amitph
amitph.com › home › java › convert list to concatenated string with delimiter in java
List of Strings to Concatenated String with Delimiter in Java | amitph
November 22, 2024 - String concatenatedString = ""; String delimiter = " "; for (String word : words) { concatenatedString += concatenatedString.equals("") ? word : delimiter + word; } System.out.println(concatenatedString);Code language: Java (java) And the output: Convert List of Strings To String · However, you should not use this approach with the Strings. Because, Strings are immutable. Hence, every time you concat a String a separate String object is created.
🌐
ZetCode
zetcode.com › java › list2string
Java List to String - Converting a List to a String in Java
May 31, 2025 - This converts a list of integers into a comma-separated string. ... This tutorial has demonstrated various methods to convert a List to a string in Java. My name is Jan Bodnar, and I am a passionate programmer with extensive programming experience. I have been writing programming articles since ...
🌐
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 - import com.google.common.base.Joiner; String result = Joiner.on(",").join(names); System.out.println(result); // Output: Alice,Bob,Charlie · Elegant API. Can skip nulls: Joiner.on(",").skipNulls().join(list); Requires external dependency. ... For most modern Java projects, String.join() and Collectors.joining() are the best and most concise options.
🌐
Baeldung
baeldung.com › home › java › java list › joining a list in java with commas and “and”
Joining a List in Java With Commas and “and” | Baeldung
March 7, 2025 - Let’s understand the problem with an example. Let’s say we have a list of strings {“A”, “B”, “C”, “D”}. If we want to join them with commas as the separator, the result would be “A, B, C, D“. So far, so good.
🌐
Kokaruk
kokaruk.com › 2017 › 09 › 15 › quickly-convert-list-of-ints-to-string-using-streams
Convert a List of Integers to a comma separated string · class Rock implements Throwable
August 23, 2020 - Originally published on 2017-09-14 Java List interface doesn’t have a method to join all members to coma separated string. Previous versions required iterating over the list and appending and instance of Stringbuilder. Using Java 8 Streams makes it more neat. https://gist.github.com/rmit-s3668804-Dzmitry-Kakaruk/7cb0f29c147cfb99e503f504ba3787f5