Currently working on a project where we have a message board server. I've gotten most everything to work except my last part where we want an arrayList that returns Oldest Messages and one for newest messages. Here is what I have so far and have tweeked and commented out some just trying new things.
public ArrayList<Message> getNewestMessages(int index)
{
if (index < 0) {
throw new IllegalArgumentException("Invalid index: " + index);
}
if (index >= this.messages.size()) {
throw new IllegalArgumentException("Invalid index: " + index);
}
return this.messages.get(index);
ArrayList<Message> userMessages = new ArrayList<Message>();
//for (Message nextMessage : this.messages) {
// if (nextMessage.getUserName().equals(name)) {
// userMessages.add(nextMessage);
// }
//}
//return userMessages;
}