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
🌐
CodeGym
codegym.cc › java blog › strings in java › java string join() method
Java String join() Method
January 8, 2025 - It always returns a concatenated ...limiter"); // joining arrayList with space between them as delimiter String joinedStr = String.join(" ", arrayOfStrings); System.out.println(joinedStr); } }...
🌐
Programiz
programiz.com › java-programming › examples › arraylist-string-conversion
Java Program to Convert the ArrayList into a string and vice versa | Programiz
March 14, 2024 - import java.util.ArrayList; class ... // 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() ...
🌐
Dot Net Perls
dotnetperls.com › convert-arraylist-string-java
Java - Convert ArrayList to String - Dot Net Perls
String res = String.join(",", arr); System.out.println(res); } } ... Sometimes we want to combine just the strings in an ArrayList, with no delimiters between them. We use an empty string literal as the delimiter. import java.util.ArrayList; public class Program { public static void main(String[] ...
🌐
TutorialKart
tutorialkart.com › java › how-to-join-elements-of-arraylist-with-delimiter-in-java
How to Join Elements of ArrayList with Delimiter in Java?
December 24, 2020 - String.join() returns a single string with all the string elements of ArrayList joined with delimiter in between them. ... import java.util.ArrayList; import java.util.Arrays; public class Example { public static void main(String[] args) { String delimiter = "--"; ArrayList<String> arrayList = new ArrayList<String>(Arrays.asList("hello", "world", "welcome")); String result = String....
🌐
BeginnersBook
beginnersbook.com › 2017 › 10 › java-string-join-method
Java String join() method
June 4, 2024 - import java.util.Arrays; import java.util.List; public class StringJoinExample { public static void main(String[] args) { List<String> sports = Arrays.asList("Cricket", "Hockey", "Tennis"); // Here, we are joining elements of an ArrayList with // comma as delimiter String result = String.join(", ...
🌐
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 - The method we are using is nothing but accepts a Iterable and since ArrayList implements Iterable interface, we can use this method to join elements on ArrayList as delimited String. This method is also null safe and null objects or empty strings within the iteration are represented by empty strings. Google Guava is one of the famous general purpose library which deserve a place in every Java project. It provides common utility classes which can make your code simpler and easier to read, write, and test. Here is an example of Google Guava's Joiner class which can be used to convert a List to String in Java.
🌐
Vultr Docs
docs.vultr.com › java › standard library › java › lang › string › join()
Java String join() - Concatenate Strings | Vultr Docs
December 27, 2024 - Define an array of strings. Use the join() method to concatenate the array’s elements.
🌐
Baeldung
baeldung.com › home › java › java string › converting a list to string in java
Converting a List to String in Java | Baeldung
July 30, 2026 - If our elements in the List aren’t subclasses of CharSequence, we can first convert the List to a List<String>, and then pass it to String.join():
Find elsewhere
🌐
Programiz
programiz.com › java-programming › library › string › join
Java String join()
These strings are joined using the - delimiter. import java.util.ArrayList; class Main { public static void main(String[] args) { ArrayList<String> text = new ArrayList<>(); // adding elements to the arraylist text.add("Java"); text.add("is"); text.add("fun"); String result; result = ...
🌐
How to do in Java
howtodoinjava.com › home › java array › join string array in java with comma or any separator
Join String Array in Java with Comma or Any Separator
3 weeks ago - The shortest way to join a String array in Java is String.join(“,”, array), which returns one String with the separator between every two elements and none after the last.
🌐
DEV Community
dev.to › satyam_gupta_0d1ff2152dcc › master-the-java-string-join-method-a-2025-guide-with-examples-best-practices-2oem
Master the Java String join() Method: A 2025 Guide with Examples & Best Practices - DEV Community
November 6, 2025 - java List failedTransactions = getFailedTransactionIds(); logger.error("Transactions failed: " + String.join("; ", failedTransactions)); // Logs: Transactions failed: TXN_001; TXN_042; TXN_101 · API Response Building When creating a response for an API, you might need to send a list of messages or errors as a single string. java // Imagine validating a user's form input List<String> errors = new ArrayList<>(); if (username.isEmpty()) errors.add("Username is required"); if (!isValidEmail(email)) errors.add("A valid email is required"); if (!errors.isEmpty()) { String errorMessage = String.join(".
🌐
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 ...
🌐
Educative
educative.io › answers › what-is-stringjoin-in-java
What is String.join() in Java?
... In the code above, we create an ArrayList with three elements and call the String.join() method with the created ArrayList and delimiter String -. The String.join() method concatenates all the strings in the iterable with the delimiter added ...
🌐
Mkyong
mkyong.com › home › java › java – how to join list string with commas
Java – How to join List String with commas | mkyong.com
November 29, 2018 - package com.mkyong; import ... static void main(String[] args) { List<String> list = Arrays.asList("a","b","c"); String result = String.join(",", list); System.out.println(result); } }...
🌐
Medium
medium.com › javarevisited › nuanced-string-joining-in-java-7db547c331d0
Nuanced String Joining in Java | Javarevisited
April 23, 2024 - I wrote an article for 97 Things Every Java Programmer Should Know with the title “Learn to Kata and Kata to Learn.” In this article, I iterate through some example Java code using Collectors.joining() and String.join() to create a comma separated list of names.
🌐
Blogger
javarevisited.blogspot.com › 2016 › 06 › 10-examples-of-joining-string-in-java-8.html
10 Examples of Joining String in Java - String.join vs StringJoiner
May 11, 2023 - Still, you won't find any such method on String, StringBuffer, StringBuilder, Arrays, or Collections class until Java 8. Now, you have a class called StringJoiner which allows you to join multiple String by a delimiter. A join() method is added into the String class to convert an array of String or a list of String joined by a delimiter of your choice.
🌐
javaspring
javaspring.net › blog › java-list-string-join
Java List String Join: A Comprehensive Guide — javaspring.net
For example, if you have a list ["apple", "banana", "cherry"] and you want to join them with a comma and a space (, ) as the delimiter, the resulting string would be "apple, banana, cherry".