Since Java 8 you can now use streams for that:
long[] arr = { 1, 2, 3, 4 };
List<Long> list = Arrays.stream(arr).boxed().collect(Collectors.toList());
More Related Contents:
- How to convert int[] into List in Java?
- Does Java JIT compiler sacrifice performance to favor Collections?
- Converting ‘ArrayList to ‘String[]’ in Java
- How can I convert List to int[] in Java? [duplicate]
- How to convert an Array to a Set in Java
- How can I convert int[] to Integer[] in Java?
- How can I get the size of an array, a Collection, or a String in Java?
- Lambda expression to convert array/List of String to array/List of Integers
- Java – generate Random range of specific numbers without duplication of those numbers – how to?
- Why does Collections.sort use Mergesort but Arrays.sort does not?
- How can I generate a list or array of sequential integers in Java?
- Java: how to convert HashMap to array
- Print array without brackets and commas
- The easiest way to transform collection to array?
- ArrayList: how does the size increase?
- How to create ArrayList (ArrayList) from array (int[]) in Java
- Iterate through string array in Java
- How to convert byte[] to Byte[] and the other way around?
- How to convert an int[] array to a List?
- What's the output of this code written in java?
- how to replace display array list equals another array list values
- Convert ArrayList to String[] array [duplicate]
- Struts2: Updating the values of a “List Of Objects” inside a Map
- How to most elegantly iterate through parallel collections?
- How to remove element from ArrayList by checking its value?
- Use of array of zero length
- How to see if an object is an array without using reflection?
- Generate Random Numbers in Array [duplicate]
- Shortcut for adding to List in a HashMap
- Perform operation on n random distinct elements from Collection using Streams API