PriorityQueue
was added in Java 1.5
new PriorityQueue()
is enabled in Android, but
new PriorityQueue(new Comparator() {
@Override
public int compare(Object o1, Object o2) {
return 0;
}
});
requires API 24. Why?
Because PriorityQueue(Comparator)
constructor was added to the SDK in API level 24. In JDK, that constructor was added in Java 8.
For compatibility with earlier API levels, you can use PriorityQueue(int,Comparator)
that has been there since API level 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With