1543 |
|
*/ |
1544 |
|
public void testToArray() throws InterruptedException { |
1545 |
|
LinkedBlockingDeque q = populatedDeque(SIZE); |
1546 |
< |
Object[] o = q.toArray(); |
1547 |
< |
for (int i = 0; i < o.length; i++) |
1548 |
< |
assertSame(o[i], q.poll()); |
1546 |
> |
Object[] a = q.toArray(); |
1547 |
> |
assertSame(Object[].class, a.getClass()); |
1548 |
> |
for (Object o : a) |
1549 |
> |
assertSame(o, q.poll()); |
1550 |
> |
assertTrue(q.isEmpty()); |
1551 |
|
} |
1552 |
|
|
1553 |
|
/** |
1558 |
|
Integer[] ints = new Integer[SIZE]; |
1559 |
|
Integer[] array = q.toArray(ints); |
1560 |
|
assertSame(ints, array); |
1561 |
< |
for (int i = 0; i < ints.length; i++) |
1562 |
< |
assertSame(ints[i], q.remove()); |
1561 |
> |
for (Integer o : ints) |
1562 |
> |
assertSame(o, q.remove()); |
1563 |
> |
assertTrue(q.isEmpty()); |
1564 |
|
} |
1565 |
|
|
1566 |
|
/** |