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 |
getHead()
Get message at head.
|
int |
getLength()
Get the total number of messages in the queue.
|
Message |
remove()
Remove message at head.
|
public MessageQueue()
public Message remove()
public void add(Message newMessage)
newMessage
- the message to be appendedpublic int getLength()