2 |
|
* @test %I% %E% |
3 |
|
* @bug 4486658 |
4 |
|
* @summary Checks that a priority queue returns elements in sorted order across various operations |
5 |
< |
* |
6 |
< |
* @compile -source 1.5 PriorityQueueSort.java |
7 |
< |
* @run main PriorityQueueSort |
5 |
> |
*/ |
6 |
> |
|
7 |
> |
/* |
8 |
> |
* Written by Doug Lea with assistance from members of JCP JSR-166 |
9 |
> |
* Expert Group and released to the public domain, as explained at |
10 |
> |
* http://creativecommons.org/licenses/publicdomain |
11 |
|
*/ |
12 |
|
|
13 |
|
import java.util.*; |
16 |
|
|
17 |
|
static class MyComparator implements Comparator<Integer> { |
18 |
|
public int compare(Integer x, Integer y) { |
19 |
< |
int i = ((Integer)x).intValue(); |
20 |
< |
int j = ((Integer)y).intValue(); |
19 |
> |
int i = x.intValue(); |
20 |
> |
int j = y.intValue(); |
21 |
|
if (i < j) return -1; |
22 |
|
if (i > j) return 1; |
23 |
|
return 0; |