E
- the type of items in our queue.public class MyQueue<E>
extends java.lang.Object
Constructor and Description |
---|
MyQueue() |
Modifier and Type | Method and Description |
---|---|
E |
dequeue()
Remove and return the front item in the queue.
|
void |
enqueue(E item)
Enqueue the given item to the back of the queue.
|
boolean |
isEmpty()
Return whether or not this queue is empty.
|
E |
peek()
Return (but do not remove) the front item in the queue.
|
java.lang.String |
toString()
Returns a string beginning and ending with left and right square brackets, respectively, and containing a comma and space separated list of queue elements ordered from the front of the queue to the back of the queue.
|
public boolean isEmpty()
public E dequeue()
public E peek()
public void enqueue(E item)
item
- the item to be enqueued to the back of the queuepublic java.lang.String toString()
toString
in class java.lang.Object