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 string of elements joined by the delimiter. import java.util.ArrayList; class Main { public static void main(String[] args) { ArrayList<String> arrayOfStrings = new ArrayList<>(); arrayOfStrings.add("Concatenating"); arrayOfStrings.add("the"); arrayOfStrings.add("array"); arrayOfStrings.add("list"); arrayOfStrings.add("elements"); arrayOfStrings.add("with"); arrayOfStrings.add("space"); arrayOfStrings.add("as"); arrayOfStrings.add("delimiter"); // joining arrayList with space between them as delimiter String joinedStr = String.join(" ", arrayOfStrings); System.out.println(joinedStr); } } Concatenating the array list elements with space as delimiter ·
🌐
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 ...tln("ArrayList: " + languages); // convert the arraylist into a string String arraylist = String.join(", ", languages); System.out.println("String: " + arraylist); } }...
🌐
Vultr Docs
docs.vultr.com › java › standard library › java › lang › string › join()
Java String join() - Concatenate Strings | Vultr Docs
December 27, 2024 - The String.join() method in Java provides a powerful and easy way to concatenate multiple strings with a specified delimiter. Whether you're working with lists, arrays, or any collection of string elements, the join() method offers a straightforward ...
🌐
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 - Call String.join() method and pass the delimiter string delimiter followed by the ArrayList<String> arrayList.
🌐
Baeldung
baeldung.com › home › java › java collections › join and split arrays and collections in java
Java - Join and Split Arrays and Collections | Baeldung
April 4, 2025 - In the following example we first join within each nested Collection and then we join the result of each of them: @Test public void whenConvertNestedCollectionToString_thenConverted() { Collection<List<String>> nested = new ArrayList<>(); nested.add(Arrays.asList("Dog", "Cat")); nested.add(Arrays.asList("Cow", "Pig")); String result = nested.stream().map( nextList -> nextList.stream() .collect(Collectors.joining("-"))) .collect(Collectors.joining("; ")); assertEquals(result, "Dog-Cat; Cow-Pig"); }
🌐
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 ... with a supplied prefix and ending with a supplied suffix. The join() method of the String class can be used to construct the same....
🌐
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
🌐
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(", ", sports); System.out.println(result); // Output: "Cricket", "Hockey", "Tennis" } } In the following example, we are using String.join() method with a variable number of string arguments.
🌐
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 - I have shared both JDK and Third party libraries which you can use to do this task easily in Java. Java 8 has added a new class called StringJoiner which can be used to join String from arrays and Collection.
🌐
CompileBytes
compilebytes.com › home › examples › java examples › how to join a list into a string in java
How to Join a List Into a String in Java | CompileBytes
September 25, 2026 - Neither String.join nor Collectors.joining skips nulls: each null element is written as the four characters null, which is rarely what you want in user-facing text. Filter them out with filter(Objects::nonNull), or swap in a default with Objects.toString(value, default). Empty and blank strings are a separate case: they aren't null, so both filters let them through. ... import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { // List.of rejects nulls, so this list is built with Arrays.asList List<String> names = Arrays.asList("Ada", null, "Grace", null); // Both joins write a null element as the text "null" System.out.println(String.join(", ", names)); System.out.println(names.stream().collect(Collectors.joining(", "))); // Drop the nulls...
🌐
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 java.util.Arrays; import java.util.List; public class JavaStringExample1 { public static void main(String[] args) { List<String> list = Arrays.asList("a","b","c"); String result = String.join(",", list); System.out.println(result); } }
🌐
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.
🌐
Medium
medium.com › javarevisited › nuanced-string-joining-in-java-7db547c331d0
Nuanced String Joining in Java | Javarevisited
April 23, 2024 - Our problem today will start with the array of Integers values from 1 to 5 and converted them to a String starting with a “*”, separating elements with “*, *” and then finishing with a “*”. Joining an Integer array into a String with a for loop is a good exercise for us to start with.
🌐
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(".
🌐
GitHub
gist.github.com › LarryBattle › 5217402
Join ArrayList in java. Combines all the elements into a string separated the `delimiter`. · GitHub
Join ArrayList in java. Combines all the elements into a string separated the `delimiter`. - Join ArrayList in java