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