This is my Add method:
public void add (Message msg)
{
messageQueues.get(msg.getPriority()).add(msg);
total++;
}
This is my remove method:
public Message remove()
{
Message temp = null;
for (int i = 9; i>-1; i--)
{
if (messageQueues.get(i).size()!=0)
{
temp = messageQueues.get(i).get(0);
messageQueues.get(i).remove(0);
return temp;
}
total--;
}
return temp;
}
}
No comments:
Post a Comment