VOOZH about

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

⇱ ConcurrentSkipListSet first() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentSkipListSet first() method in Java

Last Updated : 17 Sep, 2018
The first() method of java.util.concurrent.ConcurrentSkipListSet is an in-built function in Java which returns the first (lowest) element currently in this set. Syntax:
ConcurrentSkipListSet.first()
Return Value: The function returns the first (lowest) element currently in this set. Exception: The function throws NoSuchElementException if this set is empty. Below programs illustrate the ConcurrentSkipListSet.first() method: Program 1:
Output:
The lowest element in the set: 10
Program 2: Program to show NoSuchElementException in first().
Comment