ConcurrentSkipListSet pollFirst() method in Java
The pollFirst() method of java.util.concurrent.ConcurrentSkipListSet is an in-built function in Java which returns retrieves and removes the first (lowest) element, or returns null if this set is empty.
public E pollFirst()
Return Value: The function returns retrieves and removes the first (lowest) element, or returns null if this set is empty.
Below programs illustrate the ConcurrentSkipListSet.pollFirst() method:
Contents of the set: [10, 20, 30, 40, 50] The first element of the set: 10 Contents of the set after pollFirst: [20, 30, 40, 50]
Contents of the set:  The first element of the set: null
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.