Difference between peek(), poll() and remove() method
of the Queue interface
|
poll()
|
remove()
|
peek()
|
Action
|
Remove
the head object of Queue.
|
Remove
the head object of Queue.
|
Retrieves
but does not remove the head of the Queue.
|
Queue is null.
|
poll()
method will return null.
|
remove()
method will throw NoSuchElementException.
|
poll()
method will return null.
|
not proper explanation, contents are wrong
ReplyDelete