Use this code for that,
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
public class StringArrayTest {
public static void main(String[] args) {
String[] words = {"ace", "boom", "crew", "dog", "eon"};
List<String> wordList = Arrays.asList(words);
for (String e : wordList) {
System.out.println(e);
}
}
}
Answer from Lalit Bhudiya on Stack OverflowCoderanch
coderanch.com โบ t โบ 40 โบ 379449 โบ java โบ String-array-arraylist
String array to arraylist (Java in General forum at Coderanch)
June 7, 2012 - Ernest's solution: new ArrayList(Arrays.asList(myArray)); copies the content of the array to a new ArrayList. The copy is ofcourse independent of the array, and you can add, remove etc. elements as you like. Janarthan's solution, with Collections.addAll(myList, myStringArray); is essentially the same as Ernest's solution. If you only need read access to the array as if it is a List and you don't want to add or remove elements from the list, then use Garrett's solution. Otherwise use Ernest's or Janarthan's solution. As of Java 8: String [] strings = {"one", "two", "three"}; ...
How to convert Array to ArrayList and ArrayList to Array (Core ...
05:16
Java: Convert Array to ArrayList, and ArrayList to Array - YouTube
06:46
3 Different ways to convert arrays to Arraylist in java - YouTube
Convert an Array to an ArrayList (Java Tutorial)
03:14
how to convert array to arraylist in java - YouTube
Top answer 1 of 5
340
Use this code for that,
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
public class StringArrayTest {
public static void main(String[] args) {
String[] words = {"ace", "boom", "crew", "dog", "eon"};
List<String> wordList = Arrays.asList(words);
for (String e : wordList) {
System.out.println(e);
}
}
}
2 of 5
184
new ArrayList( Arrays.asList( new String[]{"abc", "def"} ) );
Javaprogramto
javaprogramto.com โบ 2020 โบ 07 โบ arrays-to-list-program-to-convert-array-to-list-in-java-8.html
Array to List: Program to convert Array to List in Java 8
August 7, 2020 - package com.javaprogramto.java8.arraytolist; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public class ArrayToListCollectionsAddAllExample { public static void main(String[] args) { // Example using Collections.addAll(outputList, array); String[] intArray = {"java", "program", "to.com", "is a ", "java portal"}; System.out.println("Array : " + Arrays.toString(intArray)); List<String> list = convertArrayToList(intArray); System.out.println("Converted ArrayList : " + list); } private static <T> List<T> convertArrayToList(T[] array) { Li
TutorialKart
tutorialkart.com โบ java โบ string-array-to-arraylist-in-java
How to Convert String Array to ArrayList? Examples
July 22, 2026 - Arrays.asList(String[]) returns List<String> with elements of String[] loaded to List<String>. Now, we can make use of ArrayList.addAll(List<String>) that adds elements of List to the ArrayList.
Mkyong
mkyong.com โบ home โบ java โบ java โ convert array to arraylist
Java โ Convert Array to ArrayList | mkyong.com
May 2, 2019 - package com.mkyong; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; public class ArrayExample2 { public static void main(String[] args) { String[] str = {"A", "B", "C"}; ArrayList<String> list1 = Stream.of(str).collect(Collectors.toCollection(ArrayList::new)); list1.add("D"); list1.forEach(x -> System.out.println(x)); List<String> list2 = Stream.of(str).collect(Collectors.toList()); list2.add("D"); list2.forEach(x -> System.out.println(x)); } }
Java Knowledge Base
javaknowledgebase.com โบ home โบ java programming โบ how to convert string array to list in java
How to Convert String Array to List in Java | Java 8
August 8, 2026 - List<String> list = new ArrayList<>(Arrays.asList(array)); Java 8 introduced the Stream API, which provides another way to convert an array into a List.
Top answer 1 of 6
367
You can do the following:
String [] strings = new String [] {"1", "2" };
List<String> stringList = new ArrayList<String>(Arrays.asList(strings)); //new ArrayList is only needed if you absolutely need an ArrayList
2 of 6
41
Like this :
String[] words = {"000", "aaa", "bbb", "ccc", "ddd"};
List<String> wordList = new ArrayList<String>(Arrays.asList(words));
or
List myList = new ArrayList();
String[] words = {"000", "aaa", "bbb", "ccc", "ddd"};
Collections.addAll(myList, words);
Top answer 1 of 9
72
The second one creates a new array of Integers (first pass), and then adds all the elements of this new array to the list (second pass). It will thus be less efficient than the first one, which makes a single pass and doesn't create an unnecessary array of Integers.
A better way to use streams would be
List<Integer> list = Arrays.stream(ints).boxed().collect(Collectors.toList());
Which should have roughly the same performance as the first one.
Note that for such a small array, there won't be any significant difference. You should try to write correct, readable, maintainable code instead of focusing on performance.
2 of 9
65
Simply try something like
Arrays.asList(array)
Top answer 1 of 14
342
Try something like
List<String> myList = new ArrayList<String>(Arrays.asList(s.split(",")));
Arrays.asListdocumentationString.splitdocumentationArrayList(Collection)constructor documentation
Demo:
String s = "lorem,ipsum,dolor,sit,amet";
List<String> myList = new ArrayList<String>(Arrays.asList(s.split(",")));
System.out.println(myList); // prints [lorem, ipsum, dolor, sit, amet]
2 of 14
36
String s1="[a,b,c,d]";
String replace = s1.replace("[","");
System.out.println(replace);
String replace1 = replace.replace("]","");
System.out.println(replace1);
List<String> myList = new ArrayList<String>(Arrays.asList(replace1.split(",")));
System.out.println(myList.toString());
BeginnersBook
beginnersbook.com โบ 2015 โบ 05 โบ java-string-to-arraylist-conversion
Java โ How to Convert a String to ArrayList
September 20, 2022 - 2) Create an ArrayList and copy the element of string array to newly created ArrayList using Arrays.asList() method. This method returns a list created based on the elements of the specified array. In this java program, we are converting a comma separated string to arraylist in java.
Sentry
sentry.io โบ sentry answers โบ java โบ create arraylist from array in java
Java Create ArrayList from Array with Arrays.asList | Sentry
September 17, 2026 - The easiest way to convert to an ArrayList is to use the built-in method in the Java Arrays library: Arrays.asList(array).
Java Code Geeks
examples.javacodegeeks.com โบ home โบ java development โบ core java
Java 8 Convert an Array to List Example - Java Code Geeks
February 25, 2019 - Java 8โs Arrays class provides a stream() method which has overloaded versions accepting both primitive arrays and Object arrays.
Baeldung
baeldung.com โบ home โบ java โบ java array โบ how to add string arrays to arraylist in java
How to Add String Arrays to ArrayList in Java | Baeldung
March 7, 2025 - final static String[] ARRAY1 = { "Java", "Kotlin", "Sql", "Javascript" }; final static String[] ARRAY2 = { "C", "C++", "C#", "Typescript" }; final static String[] ARRAY3 = { "Python", "Ruby", "Go", "Rust" }; Also, we have a method to produce a String List with two String elements: List<String> initLanguageList() { List<String> languageList = new ArrayList<>(); languageList.add("Languages"); languageList.add(":"); return languageList; }