545 |
|
final AtomicBoolean done = new AtomicBoolean(false); |
546 |
|
final Object one = impl.makeElement(1); |
547 |
|
final Object two = impl.makeElement(2); |
548 |
+ |
final Object[] emptyArray = |
549 |
+ |
(Object[]) java.lang.reflect.Array.newInstance(one.getClass(), 0); |
550 |
|
final List<Future<?>> futures; |
551 |
|
final Phaser threadsStarted = new Phaser(1); // register this thread |
552 |
|
final Runnable[] frobbers = { |
566 |
|
for (Object x : c) assertTrue(x == one || x == two); |
567 |
|
}, |
568 |
|
() -> { |
569 |
+ |
for (Object x : c.toArray()) assertTrue(x == one || x == two); |
570 |
+ |
}, |
571 |
+ |
() -> { |
572 |
+ |
for (Object x : c.toArray(emptyArray)) assertTrue(x == one || x == two); |
573 |
+ |
}, |
574 |
+ |
() -> { |
575 |
|
assertTrue(c.add(one)); |
576 |
|
assertTrue(c.contains(one)); |
577 |
|
assertTrue(c.remove(one)); |