VOOZH about

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

⇱ ConcurrentSkipListSet clear() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentSkipListSet clear() method in Java

Last Updated : 17 Sep, 2018
The java.util.concurrent.ConcurrentSkipListSet.clear() method is an in-built function in Java which removes all the elements from this set. Syntax:
 ConcurrentSkipListSet.clear()
Parameters: The function does not accept any parameter. Return Value: The function does not return anything. Below programs illustrate the ConcurrentSkipListSet.clear() method: Program 1:
Output:
The set contains: [10, 20, 30, 40, 50]
After clear operation the set contains: []
Program 2:
Output:
The set contains: [alex, bob, chuck, drake, eric]
After clear operation the set contains: []
Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListSet.html#clear--
Comment