public class MessageQueue extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<Message> |
queue |
Constructor and Description |
---|
MessageQueue()
Constructs an empty message queue.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Message newMessage)
Append message at tail.
|
Message |
peek()
Get message at head.
|
Message |
remove()
Remove message at head.
|
int |
size()
Get the total number of messages in the queue.
|
public MessageQueue()
public Message remove()
public void add(Message newMessage)
newMessage
- the message to be appendedpublic int size()