Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.CopyOnWriteArrayList; public class CopyOnWriteArrayListCloneExample1{ public static void main(String[] args) { //Initializing CopyOnWriteArrayList of Integers CopyOnWriteArrayList
numbers = new CopyOnWriteArrayList<>(new Integer[] {1,2,1,4,5,3,3,8}); //Prints the shallow copy of this list. System.out.println("Clone List is : " + numbers.clone()); } }
Output