What happens when pollFirst() is called on an empty LinkedList?

Last Updated :
Discuss
Comments

What happens when pollFirst() is called on an empty LinkedList?


It returns null

It throws NoSuchElementException

It removes the last element

It removes the first element

Share your thoughts in the comments