Convert Vector to ArrayList in Java Last Updated : 08 Sep, 2022 Comments Improve Suggest changes Like Article Like Report There are multiple ways to convert vector to ArrayList, using passing the Vector in ArrayList constructor and by using simple vector traversal and adding values to ArrayList. Approach 1: Create a Vector.Add some values in Vector.Create a new ArrayList.Traverse vector from the left side to the right side.Start adding each element in ArrayList.Below is the implementation of the above approach: Java // Convert Vector to ArrayList in Java import java.util.Vector; import java.util.ArrayList; public class GFG { public static void main(String[] args) { // Create a Vector that contain strings Vector<String> v = new Vector<String>(); // add values in vector v.add("a"); v.add("b"); v.add("c"); v.add("d"); v.add("e"); // Display the Vector System.out.println(" Vector : " + v); ArrayList<String> Arrlist = new ArrayList<String>(); // Convert Vector to ArrayList for (int i = 0; i < v.size(); i++) Arrlist.add(v.get(i)); // Display ArrayList System.out.println("\n ArrayList : " + Arrlist); } } Time Complexity: O(n) Approach 2: Create a Vector.Add some values in Vector.Create an ArrayList and pass the Vector in ArrayList Constructor.Syntax: ArrayList<String> ArrList = new ArrayList<String>(vector);Below is the implementation of the above approach: Java // Convert Vector to ArrayList in Java import java.util.Vector; import java.util.ArrayList; public class GFG { public static void main(String[] args) { // Create a Vector that contain strings Vector<String> v = new Vector<String>(); // add values in vector v.add("a"); v.add("b"); v.add("c"); v.add("d"); v.add("e"); // Display the Vector System.out.println(" Vector : " + v); // Convert Vector to ArrayList ArrayList<String> Arrlist = new ArrayList<String>(v); // Display ArrayList System.out.println("\n ArrayList : " + Arrlist); } } Output Vector : [a, b, c, d, e] ArrayList : [a, b, c, d, e] Time Complexity: O(n) Approach 3 : Using addAll() Declare and Initialize the Vector object with values.Now, declare the ArrayList.By using addAll() method, we can simply add all elements from Vector to ArrayList. Declare the vector object in the addAll() method i.e ArrayList_object.addAll(Vector_object).Print the ArrayList. Java // Java Program to Convert Vector to ArrayList import java.util.ArrayList; import java.util.Vector; public class GFG { public static void main(String[] args) { // Create a Vector that contain strings Vector<String> v = new Vector<String>(); // add values in vector v.add("a"); v.add("b"); v.add("c"); v.add("d"); v.add("e"); // Display the Vector System.out.println(" Vector : " + v); // Converting vector to ArrayList ArrayList<String> Arrlist = new ArrayList<String>(); Arrlist.addAll(v); // Displaying the above ArrayList System.out.println("\n ArrayList : " + Arrlist); } } Output Vector : [a, b, c, d, e] ArrayList : [a, b, c, d, e] Comment More infoAdvertise with us Next Article Convert Vector to ArrayList in Java mukulsomukesh Follow Improve Article Tags : Java Technical Scripter Technical Scripter 2020 Java-Collections Java-ArrayList Java-Vector +2 More Practice Tags : JavaJava-Collections Similar Reads How to Convert Vector to Array in Java? As we all know an array is a group of liked-typed variables that are referred to by a common name while on the other hand vectors basically fall in legacy classes but now it is fully compatible with collections. It is found in java.util package and implement the List interface which gives a superior 3 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 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 Iterating over ArrayLists in Java ArrayList is a part of collection framework and is present in java.util package. It provides us with dynamic arrays in Java. Though, it may be slower than standard arrays but can be helpful in programs where lots of manipulation in the array is needed. This class is found in java.util package. With 5 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 Join two ArrayLists in Java Given two ArrayLists in Java, the task is to join these ArrayLists. Examples:Input: ArrayList1: [Geeks, For, ForGeeks] , ArrayList2: [GeeksForGeeks, A computer portal] Output: [Geeks, For, ForGeeks, GeeksForGeeks, A computer portal] Input: ArrayList1: [G, e, e, k, s] , ArrayList2: [F, o, r, G, e, e, 1 min read How to convert LinkedList to Array in Java? Given a Linked List in Java, the task is to convert this LinkedList to Array. Examples: Input: LinkedList: ['G', 'e', 'e', 'k', 's'] Output: Array: ['G', 'e', 'e', 'k', 's'] Input: LinkedList: [1, 2, 3, 4, 5] Output: Array: [1, 2, 3, 4, 5] Approach: Get the LinkedListConvert the LinkedList to Object 2 min read Java Program to Convert ArrayList to LinkedList Given an array list, your task is to write a program to convert the given array list to Linked List in Java. Examples: Input: ArrayList: [Geeks, forGeeks, A computer Portal] Output: LinkedList: [Geeks, forGeeks, A computer Portal] Input: ArrayList: [1, 2, 3, 4, 5] Output: LinkedList: [1, 2, 3, 4, 5] 6 min read Like