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().