|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectqueue.MyQueue<E>
public class MyQueue<E>
The MyQueue class is an growable, circular, array-based implementation of the Queue interface.
| Constructor Summary | |
|---|---|
MyQueue()
Set up and initialize the Queue. |
|
| Method Summary | |
|---|---|
E |
dequeue()
Removes and returns the object at the front of the queue. |
void |
enqueue(E e)
Inserts an element at the rear of the queue. |
E |
front()
Returns, but does not remove, the object at the front of the queue. |
MyQueueDataObject<E> |
getData()
|
boolean |
isEmpty()
Checks to see if the queue is empty. |
Iterator<E> |
iterator()
Returns an iterator over the contents of the queue. |
int |
size()
Finds out how many elements are currently stored in the queue. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MyQueue()
| Method Detail |
|---|
public int size()
size in interface Queue<E>public boolean isEmpty()
isEmpty in interface Queue<E>true if the queue is empty;
false otherwisepublic void enqueue(E e)
enqueue in interface Queue<E>e - the element to be added
public E dequeue()
throws EmptyQueueException
dequeue in interface Queue<E>EmptyQueueException - if the queue is empty
public E front()
throws EmptyQueueException
front in interface Queue<E>EmptyQueueException - if the queue is empty
public MyQueueDataObject<E> getData()
throws ArrayIndexOutOfBoundsException
ArrayIndexOutOfBoundsException
public Iterator<E> iterator()
throws EmptyQueueException
iterator in interface Iterable<E>EmptyQueueException - when there are no elements in queue
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||