106
Java CopyOnWriteArrayList clone() Method
The 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 1
Output:
Clone List is : [1, 2, 1, 4, 5, 3, 3, 8]
Example 2
Output:
Clone List is : []
Example 3
Output:
Clone List is : [Tom, Harry, John, John, John, Jerry]
Example 4
Output:
Clone List is : []
Next TopicJava CopyOnWriteArrayList