The
remove() method of
CopyOnWriteArraySet removes the specified element if it is present in the set.
Syntax:
public boolean remove(Object o)
Parameters: The function accepts a mandatory parameter
o which specifies the element to be removed from the set if present.
Return Value: The function returns
true if set contains the specified element.
Below programs illustrate the above function:
Program 1:
Output:
CopyOnWriteArraySet: [32, 67, 98, 100]
Set after removal of 100 is: [32, 67, 98]
Program 2: