The difference between poll() and remove() methods is that:
remove() method will throw NoSuchElementException if the queue is empty. But poll() method will return null if Queue is empty. So we need to use these methods carefully.
remove() method will throw NoSuchElementException if the queue is empty. But poll() method will return null if Queue is empty. So we need to use these methods carefully.
No comments:
Post a Comment