15 |
|
import java.util.Queue; |
16 |
|
|
17 |
|
import junit.framework.Test; |
18 |
– |
import junit.framework.TestSuite; |
18 |
|
|
19 |
|
public class PriorityQueueTest extends JSR166TestCase { |
20 |
|
public static void main(String[] args) { |
42 |
|
* Returns a new queue of given size containing consecutive |
43 |
|
* Integers 0 ... n - 1. |
44 |
|
*/ |
45 |
< |
private PriorityQueue<Integer> populatedQueue(int n) { |
46 |
< |
PriorityQueue<Integer> q = new PriorityQueue<Integer>(n); |
45 |
> |
private static PriorityQueue<Integer> populatedQueue(int n) { |
46 |
> |
PriorityQueue<Integer> q = new PriorityQueue<>(n); |
47 |
|
assertTrue(q.isEmpty()); |
48 |
|
for (int i = n - 1; i >= 0; i -= 2) |
49 |
|
assertTrue(q.offer(new Integer(i))); |
63 |
|
} |
64 |
|
|
65 |
|
/** |
66 |
< |
* Constructor throws IAE if capacity argument nonpositive |
66 |
> |
* Constructor throws IllegalArgumentException if capacity argument nonpositive |
67 |
|
*/ |
68 |
|
public void testConstructor2() { |
69 |
|
try { |