/** * Obtain the current history to be iterated in reverse mode. This means that the returned list * iterator will be positioned at the end of the history so senders of this message must * traverse the list in reverse mode. * * @return A list iterator of Message objects positioned at the end of the list. */ public ListIterator<Message> getReverseMessageHistory(){ LinkedList<Message> list = new LinkedList<>(history); // Sort messages. Messages may be out of order when running inside of a cluster Collections.sort(list, new MessageComparator()); return list.listIterator(list.size()); }
/** * Obtain the current history to be iterated in reverse mode. This means that the returned list * iterator will be positioned at the end of the history so senders of this message must * traverse the list in reverse mode. * * @return A list iterator of Message objects positioned at the end of the list. */ public ListIterator<Message> getReverseMessageHistory(){ LinkedList<Message> list = new LinkedList<>(history); // Sort messages. Messages may be out of order when running inside of a cluster Collections.sort(list, new MessageComparator()); return list.listIterator(list.size()); }
/** * Obtain the current history as an iterator of messages to play back to a new room member. * * @return An iterator of Message objects to be sent to the new room member. */ public Iterator<Message> getMessageHistory(){ LinkedList<Message> list = new LinkedList<>(history); // Sort messages. Messages may be out of order when running inside of a cluster Collections.sort(list, new MessageComparator()); return list.iterator(); }
/** * Obtain the current history as an iterator of messages to play back to a new room member. * * @return An iterator of Message objects to be sent to the new room member. */ public Iterator<Message> getMessageHistory(){ LinkedList<Message> list = new LinkedList<>(history); // Sort messages. Messages may be out of order when running inside of a cluster Collections.sort(list, new MessageComparator()); return list.iterator(); }