595 |
|
} |
596 |
|
|
597 |
|
/** |
598 |
< |
* toArray contains all elements |
598 |
> |
* toArray contains all elements |
599 |
|
*/ |
600 |
|
public void testToArray() throws InterruptedException { |
601 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
813 |
|
} |
814 |
|
|
815 |
|
/** |
816 |
< |
* drainTo(c, n) empties first max {n, size} elements of queue into c |
816 |
> |
* drainTo(c, n) empties first min(n, size) elements of queue into c |
817 |
|
*/ |
818 |
|
public void testDrainToN() { |
819 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE*2); |
822 |
|
assertTrue(q.offer(new Integer(j))); |
823 |
|
ArrayList l = new ArrayList(); |
824 |
|
q.drainTo(l, i); |
825 |
< |
int k = (i < SIZE)? i : SIZE; |
825 |
> |
int k = (i < SIZE) ? i : SIZE; |
826 |
|
assertEquals(l.size(), k); |
827 |
|
assertEquals(q.size(), SIZE-k); |
828 |
|
for (int j = 0; j < k; ++j) |