devxlogo

How to Convert a List to an Array

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

devx-admin

Share the Post: