Java CopyOnWriteArrayList clone() MethodThe clone() method of Java CopyOnWriteArrayList class returns a shallow copy of this list. In this method, elements themselves are not copied. Syntax:Returns:This method returns a clone of this list. Example 1Test it NowOutput: Clone List is : [1, 2, 1, 4, 5, 3, 3, 8] Example 2Test it NowOutput: Clone List is : [] Example 3Test it NowOutput: Clone List is : [Tom, Harry, John, John, John, Jerry] Example 4Test it NowOutput: Clone List is : []
Next TopicJava CopyOnWriteArrayList
|