public class Comparator{
public int compare(Task t1, Task t2) {
if (t1.getPriority() == t2.getPriority()) {
return 0;
} else if (t1.getPriority() < t2.getPriority()) {
return -1;
} else {
return -1;
} //sorting max
}
}
public class otherComparator{
public int compare(Task t1, Task t2) {
if (t1.getPriority() == t2.getPriority()) {
return 0;
} else if (t1.getPriority() < t2.getPriority()) {
return -1;
} else {
return -1;
} //sorting min
}
}
otherComparator newComparator = new otherComparator();
heap.setComparator(newComparator);
System.out.println(heap.queue.toString());