Code example for PriorityQueue

Methods: pollsize

0
 
    /** 
     * @tests java.util.PriorityQueue#poll() 
     */ 
    public void test_poll_empty() { 
        PriorityQueue<Object> queue = new PriorityQueue<Object>();
        assertEquals(0, queue.size());
        assertNull(queue.poll());
    } 
 
    /** 
     * @tests java.util.PriorityQueue#peek() 
     */ 
    public void test_peek() { 
        PriorityQueue<Integer> integerQueue = new PriorityQueue<Integer>();
        int[] array = { 2, 45, 7, -12, 9 };
        for (int i = 0; i < array.length; i++) {
            integerQueue.add(array[i]);
        } 
        Arrays.sort(array);
Stop searching for code, let great code find you!  Add Codota to your java IDE