-2

I have an array as the integer I want to convert her to List without the use of loops

int[] arrya={1,2,3,4,5};
//List<Integer> myList=Arrays.asList(arrya);

1 Answers1

-1

You can make use of streams

int[] arrya={1,2,3,4,5};
List<Integer> list = Arrays.stream(arrya).boxed().collect(Collectors.toList());
Arslan
  • 400
  • 1
  • 3
  • 10