Code example for PriorityQueue

Methods: add

0
		pq = new PriorityQueue<TWrapper>( 11, new Comparitor() );
	} 
	 
	public void put( int i, RunnableAction r )
	{ 
		pq.add( new TWrapper( i, r ) );
		numLeft++;
	} 
	 
	public RunnableAction get( int i )
	{ 
		if( hasFutureActions() && pq.peek().time == i ) {
			numLeft--;
			return pq.poll().object;
		} 
		return null; 
	} 
 
	public boolean hasFutureActions() 
	{ 
		return numLeft > 0;