VOOZH about

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

⇱ ConcurrentSkipListSet size() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentSkipListSet size() method in Java

Last Updated : 17 Sep, 2018
The java.util.concurrent.ConcurrentSkipListSet.size() method is an in-built function in Java which gives the total count of the elements present in the set. Syntax:
ConcurrentSkipListSet.size()
Parameters: The function does not accept any parameter. Return Value: The function returns the number of elements in the queue. Below programs illustrate the ConcurrentSkipListSet.size() method: Program 1:
Output:
Number of elements in the set = 10
set : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Program 2:
Output:
Number of elements in the set = 5
set : [A, B, C, D, E]
Reference:https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListSet.html#size--
Comment