public interface FifoQueue<T>
remove
will result
in the removal of the next element, or the oldest element in the queue.
Modifier and Type | Method and Description |
---|---|
void |
add(T element)
Inserts a new element into the queue.
|
boolean |
add(T element,
long timeout)
Inserts a new element into the queue.
|
boolean |
isEmpty()
Used to test if the current queue has no stored elements.
|
T |
remove()
Removes the oldest element from the queue.
|
T |
remove(long timeout)
Removes the next element from the queue if one becomes available before
the timeout expires.
|
int |
size()
Returns the current number of elements that are in the queue.
|
void add(T element) throws FifoQueueException, InterruptedException
T
- a T object.element
- The object to append to the queue.FifoQueueException
- Thrown if a queue error occurs.InterruptedException
- Thrown if the thread is interrupted.FifoQueueException
- if any.InterruptedException
- if any.boolean add(T element, long timeout) throws FifoQueueException, InterruptedException
timeout
expires, then a false
value is returned to the caller.element
- The object to append to the queue.timeout
- The time to wait on the insertion to succeed.FifoQueueException
- Thrown if a queue error occurs.InterruptedException
- Thrown if the thread is interrupted.UnsupportedOperationException
- Thrown if the method is not supported.FifoQueueException
- if any.InterruptedException
- if any.T remove() throws FifoQueueException, InterruptedException
FifoQueueException
- Thrown if a queue error occurs.InterruptedException
- Thrown if the thread is interrupted.FifoQueueException
- if any.InterruptedException
- if any.T remove(long timeout) throws FifoQueueException, InterruptedException
null
reference is returned to the caller.timeout
- The time to wait on an object to be available.null
if one is
not available.FifoQueueException
- Thrown if a queue error occurs.InterruptedException
- Thrown if the thread is interrupted.UnsupportedOperationException
- Thrown if the method is not supported.FifoQueueException
- if any.InterruptedException
- if any.int size()
boolean isEmpty()
Copyright © 2015. All Rights Reserved.