Convert a Set of String to a comma separated String in Java Last Updated : 11 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report Given a Set of String, the task is to convert the Set to a comma separated String in Java. Examples: Input: Set<String> = ["Geeks", "ForGeeks", "GeeksForGeeks"] Output: "Geeks, For, Geeks" Input: Set<String> = ["G", "e", "e", "k", "s"] Output: "G, e, e, k, s" Approach: This can be achieved with the help of join() method of String as follows. Get the Set of String. Form a comma separated String from the Set of String using join() method by passing comma ', ' and the set as parameters. Print the String. Below is the implementation of the above approach: Java // Java program to convert Set of String // to comma separated String import java.util.*; public class GFG { public static void main(String args[]) { // Get the Set of String Set<String> set = new HashSet<>( Arrays .asList("Geeks", "ForGeeks", "GeeksForGeeks")); // Print the Set of String System.out.println("Set of String: " + set); // Convert the Set of String to String String string = String.join(", ", set); // Print the comma separated String System.out.println("Comma separated String: " + string); } } Output: Set of String: [ForGeeks, Geeks, GeeksForGeeks] Comma separated String: ForGeeks, Geeks, GeeksForGeeks Comment More infoAdvertise with us Next Article Convert a String to a List of Characters in Java R RishabhPrabhu Follow Improve Article Tags : Java Practice Tags : Java Similar Reads Convert Set of String to Array of String in Java Given a Set of Strings, the task is to convert the Set into an Array of Strings in Java. Examples: Input: Set<String>: ["ForGeeks", "A Computer Portal", "Geeks"] Output: String[]: ["ForGeeks", "A Computer Portal", "Geeks"] Input: Set<String>: ["G", "e", "k", "s"] Output: String[]: ["G", 6 min read Convert String into comma separated List in Java Given a String, the task is to convert it into comma separated List. Examples: Input: String = "Geeks For Geeks" Output: List = [Geeks, For, Geeks] Input: String = "G e e k s" Output: List = [G, e, e, k, s] Approach: This can be achieved by converting the String into String Array, and then creating 2 min read Convert a String to a List of Characters in Java In Java, to convert a string into a list of characters, we can use several methods depending on the requirements. In this article, we will learn how to convert a string to a list of characters in Java.Example:In this example, we will use the toCharArray() method to convert a String into a character 3 min read Convert List of Characters to String in Java Given a list of characters. In this article, we will write a Java program to convert the given list to a string. Example of List-to-String ConversionInput : list = {'g', 'e', 'e', 'k', 's'} Output : "geeks" Input : list = {'a', 'b', 'c'} Output : "abc" Strings - Strings in Java are objects that are 4 min read How to Convert Character Array to String in Java? Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special character "\0". A character array can be converted to a string and vice versa. In this article, we will discuss how to convert a character array to a string 4 min read Convert Stream to Set in Java Below given are some methods which can be used to convert Stream to Set in Java. Method 1 : Using Collectors Stream collect() method takes elements from a stream and stores them in a collection.collect(Collector.toSet()) collects elements from a stream to a Set. Stream.collect() method can be used t 3 min read Like