public void removeMessagesOfType(int type) { Iterator<Message> it = iterator(); while (it.hasNext()) { Message message = it.next(); if (message.getMessageType() == type) it.remove(); } }
public void keepOnlyMessagesOfType(int type) { Iterator it = iterator(); while (it.hasNext()) { Message message = (Message) it.next(); if (message.getMessageType() != type) it.remove(); } }
public boolean containsMessagesOfType(int type) { Iterator<Message> it = iterator(); while (it.hasNext()) { Message message = it.next(); if (message.getMessageType() == type) return true; } return false; }
public List<Message> getMessagesOfType(int type) { List<Message> result = new ArrayList<Message>(); for (Message message : this) { if (message.getMessageType() == type) { result.add(message); } } return result; }
public List getMessagesOfType(int type) { List l = new ArrayList(); Iterator it = iterator(); while (it.hasNext()) { Message message = (Message) it.next(); if (message.getMessageType() == type) { l.add(message); } } return l; }
public static void receive(Message message) { enqueueRunnable(message.getMessageType(), new MessageDeliveryTask(message)); }