Previously we have discussed about
Here we learn about AbstractQueue in Java,but before that we must know What is Queue Interface in Java ? and What is Collection Interface In Java ?
Class AbstractQueue<E>
Type Parameters:
E - the type of elements held in this collection
All Implemented Interfaces:
Iterable<E>, Collection<E>, Queue<E>
Direct Known Subclasses:
ArrayBlockingQueue, ConcurrentLinkedQueue, DelayQueue, LinkedBlockingDeque, LinkedBlockingQueue, LinkedTransferQueue, PriorityBlockingQueue, PriorityQueue, SynchronousQueue
Declaration of AbstractQueue:
public abstract class AbstractQueue<E>
extends AbstractCollection<E>
implements Queue<E>
AbstractQueue class provides skeletal implementations of some Queue operations.The implementations in this class are appropriate when the base implementation does not allow null elements.
Methods add, remove, and element are based on offer, poll, and peek, respectively, but throw exceptions instead of indicating failure via false or null returns.
This class is a member of the Java Collections Framework.
Constructor Summary of AbstractQueue:
Constructor
|
Description
|
protected AbstractQueue()
|
Constructor for use by subclasses.
|
Method Summary of AbstractQueue:
Modifier and Method Name
|
Description
|
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.
|
boolean addAll(Collection<? extends E> c)
|
Adds all of the elements in the specified collection to this queue.
|
void clear()
|
Removes all of the elements from this queue.
|
E element()
|
Retrieves, but does not remove, the head of this queue.
|
E remove()
|
Retrieves and removes the head of this queue.
|
Blog Author - Pushkar Khosla,
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.


Highly recommended Angular 2 course now at 40% off!!
ReplyDeletehttps://www.udemy.com/ultimate-angular-2/?couponCode=I-LOVE-ANGULAR2