Comparador de Java de cola prioritaria

// Java program to demonstrate working of 
// comparator based priority queue constructor
import java.util.*;
  
public class Example {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        // Creating Priority queue constructor having 
        // initial capacity=5 and a StudentComparator instance 
        // as its parameters
        PriorityQueue<Student> pq = new 
             PriorityQueue<Student>(5, new StudentComparator());
                  
             
        } 
    }
} 
  
class StudentComparator implements Comparator<Student>{
              
            // Overriding compare()method of Comparator 
                        // for descending order of cgpa
            public int compare(Student s1, Student s2) {
                if (s1.cgpa < s2.cgpa)
                    return 1;
                else if (s1.cgpa > s2.cgpa)
                    return -1;
                                return 0;
                }
        }
  
Depressed Dingo