389 |
|
*/ |
390 |
|
public void testToArray() { |
391 |
|
ConcurrentLinkedQueue q = populatedQueue(SIZE); |
392 |
< |
Object[] o = q.toArray(); |
393 |
< |
for (int i = 0; i < o.length; i++) |
394 |
< |
assertSame(o[i], q.poll()); |
392 |
> |
Object[] a = q.toArray(); |
393 |
> |
assertSame(Object[].class, a.getClass()); |
394 |
> |
for (Object o : a) |
395 |
> |
assertSame(o, q.poll()); |
396 |
> |
assertTrue(q.isEmpty()); |
397 |
|
} |
398 |
|
|
399 |
|
/** |
404 |
|
Integer[] ints = new Integer[SIZE]; |
405 |
|
Integer[] array = q.toArray(ints); |
406 |
|
assertSame(ints, array); |
407 |
< |
for (int i = 0; i < ints.length; i++) |
408 |
< |
assertSame(ints[i], q.poll()); |
407 |
> |
for (Integer o : ints) |
408 |
> |
assertSame(o, q.poll()); |
409 |
> |
assertTrue(q.isEmpty()); |
410 |
|
} |
411 |
|
|
412 |
|
/** |