Java – Queue Interface

Java Queue Interface methods, variables available in Java 8 release are listed below. We will publish example program on each methods ASAP.

Methods in Java Queue Interface

S.No Method & Description
1 boolean add(E e)

Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available.
2 E element()

Retrieves, but does not remove, the head of this queue.
3 boolean offer(E e)

Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.
4 E peek()

Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
5 E poll()

Retrieves and removes the head of this queue, or returns null if this queue is empty.
6 E remove()

Retrieves and removes the head of this queue.

Ask your questions in eHowToNow Forum

Post your technical, non-technical doubts, questions in our site. Get answer as soon as possible, meanwhile you can help others by answering, unanswered questions.
To Ask new Question : Ask Question
Check our existing discussions : Questions & Answers

  1. Java – ReentrantReadWriteLock.ReadLock Class
  2. Java – Set Interface
  3. Java – Iterator Interface
  4. Java – Collectors Class
  5. Java – StampedLock Class
  6. Java – IntSummaryStatistics Class
  7. Java ArrayList add(E e) method with example
  8. Java – LongConsumer Interface
  9. Java ArrayList isEmpty() method with example
  10. Java ArrayList lastIndexOf() method with example
  11. Java – Base64 Class
  12. Java – ScheduledFuture Interface
  13. Java – ThreadPoolExecutor.AbortPolicy Class
  14. Java – Executor Interface
  15. Java – DoubleSummaryStatistics Class

Be the first to comment

Leave a Reply