VOOZH about

URL: https://www.geeksforgeeks.org/java/concurrentskiplistset-remove-method-in-java/

⇱ ConcurrentSkipListSet remove() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentSkipListSet remove() method in Java

Last Updated : 17 Sep, 2018
The java.util.concurrent.ConcurrentSkipListSet.remove() method is an in-built function in Java which is used to remove an element if it is present in this set. Syntax:
ConcurrentSkipListSet.remove(Object o)
Parameters: The function accepts a single parameter o i.e. the object to be removed. Return Value: The function returns a true boolean value on successful removal of the object, otherwise returns false. Below programs illustrate ConcurrentSkipListSet.remove() method: Program 1: The element to be removed is present in the set.
Output:
The elements in the set are:
1 2 3 4 5 
Remaining elements in set : 
2 3 4
Program 2: The element to be removed is not present in the set.
Output:
The elements in the set are:
10 11 12 13 14 15 
Remaining elements in set : 
10 11 12 13 14 15
Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListSet.html#remove-java.lang.Object-
Comment