Code example for PriorityQueue

Methods: comparator

0
    public void test_comparator() { 
        PriorityQueue<Object> queue = new PriorityQueue<Object>();
        assertNull(queue.comparator());
 
        MockComparator<Object> comparator = new MockComparator<Object>();
        queue = new PriorityQueue<Object>(100, comparator);
        assertEquals(comparator, queue.comparator());
    } 
     
    /** 
     * @tests serialization/deserialization. 
     */ 
    public void test_Serialization() throws Exception { 
        Integer[] array = { 2, 45, 7, -12, 9, 23, 17, 1118, 10, 16, 39 };
        List<Integer> list = Arrays.asList(array);
        PriorityQueue<Integer> srcIntegerQueue = new PriorityQueue<Integer>(
                list);
        PriorityQueue<Integer> destIntegerQueue = (PriorityQueue<Integer>) SerializationTester
                .getDeserilizedObject(srcIntegerQueue);
        Arrays.sort(array);
        for (int i = 0; i < array.length; i++) {