String[] arr = { 1, 2, 3, 4 }
ArrayList<Integer> list = new ArrayList<Integer>();
Collections.addAll(list, arr);
// 'list' now contains [1, 2, 3, 4]
List<Element> list = Arrays.asList(array);
Integer[] array = new Integer[] {
23, 54, 12
};
java.util.List<Integer> list = java.util.Arrays.asList(array);
System.out.println(list);
using System;
using System.Collections.Generic;
using System.Linq;
public class Example
{
public static void Main()
{
int[] array = { 1, 2, 3, 4, 5 };
List<int> list = array.ToList();
// List<int> list = array.OfType<int>().ToList();
// List<int> list = array.Cast<int>().ToList();
Console.WriteLine(String.Join(",", list));
}
}
ArrayList<Integer> list = new ArrayList<>(OtherList);
//it will copy all elements from OtherList to this one
//time complexity - O(n)
List<Integer> vals = IntStream.of(shuffled).boxed().collect(Collectors.toList());