|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoldman.collection.positional.Queue<E>
public class Queue<E>
A queue is a more specialized abstraction than a buffer that maintains a first-in, first-out (FIFO) line. Elements can only be inserted at the back of the line and removed from the front of the line.
Constructor Summary | |
---|---|
Queue()
|
|
Queue(int capacity)
|
|
Queue(int capacity,
boolean bounded)
|
|
Queue(int capacity,
boolean bounded,
boolean tracked)
|
Method Summary | |
---|---|
void |
clear()
Removes all elements from the queue. |
boolean |
contains(E value)
Returns true if and only if the given value is contained within the queue. |
E |
dequeue()
Removes the element from the front of the queue. |
void |
enqueue(E element)
Inserts element at the end of the queue |
int |
getSize()
Returns the number of elements in the queue. |
boolean |
isEmpty()
Returns true if and only if there are no elements in the queue. |
Locator<E> |
iterator()
Returns an iterator initialized at FORE. |
E |
peek()
Returns the first object in the queue. |
String |
toString()
Returns a string representation of the elements in the queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Queue()
public Queue(int capacity)
public Queue(int capacity, boolean bounded)
public Queue(int capacity, boolean bounded, boolean tracked)
Method Detail |
---|
public void clear()
public boolean contains(E value)
public int getSize()
public boolean isEmpty()
public String toString()
toString
in class Object
public Locator<E> iterator()
public E peek()
public void enqueue(E element)
element
at the end of the queue
element
- the new element to insert
AtCapacityException
- a bounded queue is fullpublic E dequeue()
NoSuchElementException
- the queue is empty
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |