Compare in Java

Compare in PriorityQueue


PriorityQueue pq = new PriorityQueue(10, new Comparator(){
    @Override
    public int compare(){

    }
})

Sort

Arrays.sort(twoDim, new Comparator<Integer>() {
    @Override
    public int compare(int o1, int o2) {
        if(o1 > o2) return 1;
        else if (o1 < o2) return -1;
        else return 0;
    }
});