public class MyQueue
extends Object
Modifier and Type | Field and Description |
---|---|
(package private) int |
count
Count to reflect the Queue size.
|
(package private) Node |
head
This global field will always hold a reference to the
start of your Queue.
|
(package private) Object |
monitor |
Constructor and Description |
---|
MyQueue() |
Modifier and Type | Method and Description |
---|---|
void |
add(Object o)
Add an Object to the Queue.
|
boolean |
isEmpty()
Determine whether the Queue is empty or not
|
Node |
peek()
Return, but don't remove, the first element in the Queue
|
Node |
remove()
Remove the first element in the Queue.
|
int |
size()
Determine the size of the Queue
|
Node head
Object monitor
int count
public void add(Object o)
o
- - the object to be addedpublic Node remove()
public Node peek()
public boolean isEmpty()
public int size()