How to Add All Items From a Collection to an ArrayList in Java? Last Updated : 13 Feb, 2025 Comments Improve Suggest changes Like Article Like Report In Java, to add all items from a collection to an ArrayList we use the addAll() method. This method appends all elements from a specified collection to the end of the list.Approach:Get the Collection whose items are to be added to the ArrayList.Create an ArrayListAdd all the items of Collection into this ArrayList using ArrayList.addAll() method.ArrayList with all the items of Collections have been created.Example: This example demonstrates how to add all elements from a collection to an ArrayList using the addAll() method. Java // Java Program to add all items // from a collection to an ArrayList // using addAll() method import java.util.ArrayList; import java.util.Collection; public class Geeks { public static void main(String[] args) { // Create a Collection Collection<String> c = new ArrayList<>(); c.add("A"); c.add("B"); c.add("C"); // Create an ArrayList ArrayList<String> al = new ArrayList<>(); // Add all items from the collection // to the ArrayList al.addAll(c); // Print the ArrayList System.out.println(al); } } Output[A, B, C] Comment More infoAdvertise with us Next Article How to Add All Items From a Collection to an ArrayList in Java? C code_r Follow Improve Article Tags : Java Java-Collections Java-ArrayList Practice Tags : JavaJava-Collections Similar Reads How to add selected items from a collection to an ArrayList in Java? Given a Collection with some values, the task is to add selected the items of this Collection to an ArrayList in Java. Examples: Input: Collection = [1, 2, 3], condition = (item != 2) Output: ArrayList = [1, 3] Input: Collection = [GFG, Geek, GeeksForGeeks], condition = (item != GFG) Output: ArrayLi 2 min read How to Convert HashMap to ArrayList in Java? In Java a HashMap is a collection that stores key-value pairs on the other hand, an ArrayList is a collection that stores dynamic arrays. There are some scenarios where we need to convert a HashMap into an ArrayList such as:Extracting only the keys or values in the list form.Converting key-value pai 2 min read Conversion of Array To ArrayList in Java Following methods can be used for converting Array To ArrayList: Method 1: Using Arrays.asList() method Syntax: public static List asList(T... a) // Returns a fixed-size List as of size of given array. // Element Type of List is of same as type of array element type. // It returns an List containing 5 min read How to Get ArrayList from Stream in Java 8? Given a Stream, the task is to convert this Stream into ArrayList in Java 8. Examples:Input: Stream: [1, 2, 3, 4, 5]Output: ArrayList: [1, 2, 3, 4, 5]Input: Stream: ['G', 'e', 'e', 'k', 's']Output: ArrayList: ['G', 'e', 'e', 'k', 's']1. Using Collectors.toList() method: Approach:Get the Stream to be 2 min read Array to ArrayList Conversion in Java In Java, arrays are fixed-sized, whereas ArrayLists are part of the Java collection Framework and are dynamic in nature. Converting an array to an ArrayList is a very common task and there are several ways to achieve it.Methods to Convert Array to an ArrayList1. Using add() Method to Manually add th 3 min read Like