/*
 * @topic T02625 Java Generics demo
 * @brief class PriorityQueTree
*/

package demo;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Iterator;
import java.util.TreeMap;

public class PriorityQueTree< E > {
    private TreeMap< Integer, E > map;

    public PriorityQueTree()
    {
        map = new TreeMap< Integer, E >();
    }

    public void push( int priority, E value ) {
        map.put(priority, value);
    }

    public E pull()
    {
        // Return value from the top of the TreeMap:
        Integer key = map.firstKey();
        E temp = map.get( key );
        map.remove( key );
        return temp;
    }

    public int size()
    {
        return map.size();
    }
}//class PriorityQueTree< E >