Convert an array of primitive longs into a List of Longs

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());

Leave a Comment