offer
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available. 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.
Return
true if the element was added to this queue, else false
Parameters
the element to add
Throws
if the class of the specified element prevents it from being added to this queue
if the specified element is null
if some property of the specified element prevents it from being added to this queue
Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available.
Return
true if successful, or false if the specified waiting time elapses before space is available
Parameters
the element to add
how long to wait before giving up, in units of unit
a TimeUnit determining how to interpret the timeout parameter
Throws
if interrupted while waiting
if the class of the specified element prevents it from being added to this queue
if the specified element is null
if some property of the specified element prevents it from being added to this queue