Convert String into comma separated List in Java Last Updated : 11 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 an List from that array. However this List can be of 2 types based on their method of creation - modifiable, and unmodifiable. Creating an unmodifiable List: Java // Java program to convert String // to comma separated List import java.util.*; public class GFG { public static void main(String args[]) { // Get the String String string = "Geeks For Geeks"; // Print the String System.out.println("String: " + string); // convert String to array of String String[] elements = string.split(" "); // Convert String array to List of String // This List is unmodifiable List<String> list = Arrays.asList(elements); // Print the comma separated List System.out.println("Comma separated List: " + list); } } Output: String: Geeks For Geeks Comma separated List: [Geeks, For, Geeks] Creating a modifiable List: Java // Java program to convert String // to comma separated List import java.util.*; public class GFG { public static void main(String args[]) { // Get the String String string = "Geeks For Geeks"; // Print the String System.out.println("String: " + string); // convert String to array of String String[] elements = string.split(" "); // Convert String array to List of String // This List is modifiable List<String> list = new ArrayList<String>( Arrays.asList(elements)); // Print the comma separated List System.out.println("Comma separated List: " + list); } } Output: String: Geeks For Geeks Comma separated List: [Geeks, For, Geeks] Comment More infoAdvertise with us Next Article Program to Convert List to Map in Java R RishabhPrabhu Follow Improve Article Tags : Java Practice Tags : Java Similar Reads Convert a Set of String to a comma separated String in Java 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 achiev 1 min read Convert List to Set in Java Java Set is a part of java.util package and extends java.util.Collection interface. It does not allow the use of duplicate elements and at max can accommodate only one null element. Few important features of the Java Set interface are as follows: The set interface is an unordered collection of objec 5 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 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 Program to Convert List to Map in Java The List is a child interface of Collection. It is an ordered collection of objects in which duplicate values can be stored. Since List preserves the insertion order, it allows positional access and insertion of elements. List Interface is implemented by ArrayList, LinkedList, Vector and Stack class 5 min read Convert List to Array in Java The List interface provides a way to store the ordered collection. It is a child interface of Collection. It is an ordered collection of objects where duplicate values can be stored. Since List preserves the insertion order, it allows positional access and insertion of elements. Now here we are give 5 min read Like