public class MessageQueue
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
private MessageListNode |
first |
The first node in the queue, which is also where the nodes will be
removed from
|
private MessageListNode |
last |
The last node in the queue, which is also where the nodes will added
after
|
| Constructor | Description |
|---|---|
MessageQueue() |
Constructs a MessageQueue, setting both the first and last node pointers
to null
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
add(Message msg) |
Adds a Message to the queue
|
boolean |
isEmpty() |
Returns whether the queue is empty
|
Message |
peek() |
Returns the first Message in the queue (without removing it); which
should be the first one added to the queue (FIFO)
|
Message |
remove() |
Returns and removes the first Message in the queue, which should be the first
one added to the queue (FIFO)
|
private MessageListNode first
private MessageListNode last
public MessageQueue()
public boolean isEmpty()
public void add(Message msg)
msg - the Message to be addedpublic Message peek()
public Message remove()