Inserts the specified element into this queue if it is possible to do
so immediately without violating capacity restrictions.
When using a capacity-restricted queue, this method is generally
preferable to add
, which can fail to insert an element only
by throwing an exception.
e | the element to add |
true
if the element was added to this queue, else
false
ClassCastException | if the class of the specified element prevents it from being added to this queue | |
NullPointerException | if the specified element is null and this queue does not permit null elements | |
IllegalArgumentException | if some property of this element prevents it from being added to this queue |
Diagram: Collection Queue