Code example for PriorityQueue

Methods: add

0
	}	 
	 
	private PriorityQueue<ExtendedMessage> queue = new PriorityQueue<ExtendedMessage>(10,new ExtendedMessageComparator());
	 
	public void putMessage(Message msg, MessagePriority priority){
		queue.add(new ExtendedMessage(msg, priority));
	} 
	 
	public Message pollMessage(){
		return queue.poll().getMessage();
	} 
	 
	public int getSize(){ 
		return queue.size();
	} 
}