|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectQueue<Key>
public class Queue<Key>
A class representing a queue data structure implemented using an array. For example:
Queue q = new Queue(10);
StdOut.println(q);
| Constructor Summary | |
|---|---|
Queue(int size)
Creates an empty queue. |
|
| Method Summary | |
|---|---|
Key |
dequeue()
Deletes an element from the queue. |
void |
enqueue(Key elem)
Adds an element to the queue. |
boolean |
isEmpty()
Checks a queue for emptiness. |
int |
size()
Returns a number of elements in the queue. |
String |
toString()
Intended only for debugging. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Queue(int size)
size - array size| Method Detail |
|---|
public boolean isEmpty()
public void enqueue(Key elem)
elem - element to be added to the queuepublic Key dequeue()
Queuepublic int size()
public String toString()
toString in class Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||