Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Java
  3. Question
Java

Queue offer vs add - what's the difference?

Asked by Alex Gonzalez Oct 13, 2022 2.2K views 1 answer
Share

About this question

 In java.util.PriorityQueue we have the methods add(E e) and offer(E e). Both methods are documented as:


Inserts the specified element into this priority queue.

What are the differences between these two methods?

Your answer

1 Answer

More Java discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Java Blogs

Guides, tips and career advice on Java from JanBask experts.