List<Element> list = Arrays.asList(array);
List<String> list=new ArrayList<String>();
list.add("sravan");
list.add("vasu");
list.add("raki");
// Conversion part
String names[]=list.toArray(new String[list.size()])
List<String> list = new ArrayList<>();
list.add("a");
list.add("ab");
list.add("abc");
list.add("abcd");
// convert
String[] array = list.toArray();
ArrayList<String> ArrayLister=new ArrayList<>(){ArrayLister.add("Hi")};
String[] array=ArrayLister.toArray(String[]);
Integer[] arr = new Integer[al.size()];
for (int i = 0; i < al.size(); i++)
arr[i] = al.get(i);
String[][] w = allProducts.toArray(new String[][] {});
public class Main {
public static void main(String[] args) {
String[] array = {"Dog", "Cat", "Horse", "Turtle"};
ArrayList<String> array1 = new ArrayList<>();
for (int i = 0; i < array.length; i++) {
array1.add(array[i]);
}
System.out.println(array1);
}
Integer[] arr = new Integer[al.size()];
arr = al.toArray(arr);
ArrayList<Integer> list = new ArrayList<>(OtherList);
//it will copy all elements from OtherList to this one
//time complexity - O(n)
String[] geeks = {"Rahul", "Utkarsh", "Shubham", "Neelam"};
// Conversion of array to ArrayList using Arrays.asList
List al = Arrays.asList(geeks);