Constructor for use by subclasses.
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning {@code true} upon success and throwing an {@code IllegalStateException} if no space is currently available.
Adds all of the elements in the specified collection to this queue. Attempts to addAll of a queue to itself result in {@code IllegalArgumentException}. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.
Removes all of the elements from this queue. The queue will be empty after this call returns.
Retrieves, but does not remove, the head of this queue. This method differs from {@link #peek peek} only in that it throws an exception if this queue is empty.
Retrieves and removes the head of this queue. This method differs from {@link #poll poll} only in that it throws an exception if this queue is empty.
This class provides skeletal implementations of some {@link Queue} operations. The implementations in this class are appropriate when the base implementation does <em>not</em> allow {@code null} elements. Methods {@link #add add}, {@link #remove remove}, and {@link #element element} are based on {@link #offer offer}, {@link #poll poll}, and {@link #peek peek}, respectively, but throw exceptions instead of indicating failure via {@code false} or {@code null} returns.
<p>A {@code Queue} implementation that extends this class must minimally define a method {@link Queue#offer} which does not permit insertion of {@code null} elements, along with methods {@link Queue#peek}, {@link Queue#poll}, {@link Collection#size}, and {@link Collection#iterator}. Typically, additional methods will be overridden as well. If these requirements cannot be met, consider instead subclassing {@link AbstractCollection}.
<p>This class is a member of the <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework"> Java Collections Framework</a>.
@author Doug Lea @param (E) the type of elements held in this queue