Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.CopyOnWriteArrayList; import java.util.Arrays; public class CopyOnWriteArrayListToArrayExample11{ public static void main(String[] args) { //Initializing CopyOnWriteArrayList of Integers CopyOnWriteArrayList
numbers = new CopyOnWriteArrayList<>(new Integer[] {1,2,1,4,5,3,3,8}); Object[] toArrayList = {1,2,10,20,6,6,6,6,6,6,6,6,6,6,6}; //Converting list to array list toArrayList = numbers.toArray(toArrayList); Arrays.toString(toArrayList); //Prints Array List System.out.println("Array List is : " + Arrays.toString(toArrayList)); } }
Output