MailBox Class
public class MailBox {
ArrayList<TwootMessage> messages = new ArrayList<TwootMessage>();
public void addMessage(TwootMessage message){
if(messages.size() < 100){
messages.add(message);
Collections.sort(messages);
}
else{
System.out.println("The Mailbox is full, cant add more messages, sorry!");
}
}
public void deleteMessage(int messageIndex){
messages.remove(messageIndex);
}
public TwootMessage getFirstMessage(){
return messages.get(0);
}
}
This is my code. I am trying to be able to create two types of mailbox from this class one that only accept TextTwoot and one that accept everything. TwoootMessage is the superclass for textTwoot and some other type of twoots. Can anyone please offer some help? Thank you