public interface IQueue<E>
Modifier and Type | Method and Description |
---|---|
void |
add(E item)
Inserts the specified element into this queue,
returning true upon success.
|
void |
clear()
Removes all of the elements from this queue.
|
boolean |
contains(java.lang.Object o)
Returns true if this queue contains the specified element.
|
E |
element()
Retrieves, but does not remove, the head of this queue.
|
boolean |
isEmpty()
Returns true if this queue contains no elements.
|
boolean |
offer(E e)
Inserts the specified element into this queue if it is possible to do so
immediately without violating capacity restrictions.
|
E |
peek()
Retrieves, but does not remove, the head of this queue.
|
E |
poll()
Retrieves and removes the head of this queue.
|
E |
remove()
Retrieves and removes the head of this queue.
|
int |
size()
Returns the number of elements in this queue.
|
java.lang.String |
toString()
Returns a string representation of this queue.
|
void add(E item)
This method throws an IllegalStateException if no space is available to hold the new item.
item
- the item to addjava.lang.IllegalStateException
- if the queue is fullboolean offer(E e)
e
- the element to addE poll()
E remove()
java.util.NoSuchElementException
- if this queue is emptyE peek()
E element()
java.util.NoSuchElementException
- if this queue is emptyboolean isEmpty()
int size()
void clear()
java.lang.String toString()
toString
in class java.lang.Object
boolean contains(java.lang.Object o)
o
- object to be checked for containment in this queue