How to Convert a List to an Array

One way to convert a list to an array is shown below:

List list = Arrays.asList(1, 2, 3);Integer[] array = new Integer[list.size()];array = list.toArray(array);
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

More From DevX