Code example for PriorityQueue

Methods: addcomparator

0
		pq.clear();
		System.out.println("priority queue values after clear"+pq);
	} 
	 
	private static void testComparator(){ 
		PriorityQueue<Integer>pq=new PriorityQueue<Integer>();
		 
		pq.add(6);
		pq.add(9);
		pq.add(5);
		 
		System.out.println("priority queue values are"+pq);
		 
		Comparator comp=pq.comparator();
		System.out.println("comparator value is"+comp);
	} 
	 
	private static void testIterator(){ 
		PriorityQueue<Integer> pq=new PriorityQueue<Integer>();
		for(int i=0;i<10;i++){
Stop searching for code, let great code find you!  Add Codota to your java IDE