15 |
|
import java.util.Comparator; |
16 |
|
import java.util.Iterator; |
17 |
|
import java.util.List; |
18 |
– |
import java.util.Queue; |
18 |
|
import java.util.PriorityQueue; |
19 |
+ |
import java.util.Queue; |
20 |
|
|
21 |
|
public class PriorityQueueSort { |
22 |
|
|
23 |
|
static class MyComparator implements Comparator<Integer> { |
24 |
|
public int compare(Integer x, Integer y) { |
25 |
< |
int i = x.intValue(); |
26 |
< |
int j = y.intValue(); |
27 |
< |
if (i < j) return -1; |
28 |
< |
if (i > j) return 1; |
29 |
< |
return 0; |
25 |
> |
return Integer.compare(x.intValue(), y.intValue()); |
26 |
|
} |
27 |
|
} |
28 |
|
|