32 |
|
} |
33 |
|
|
34 |
|
/** |
35 |
< |
* Create a set of given size containing consecutive |
35 |
> |
* Returns a new set of given size containing consecutive |
36 |
|
* Integers 0 ... n. |
37 |
|
*/ |
38 |
|
private ConcurrentSkipListSet<Integer> populatedSet(int n) { |
49 |
|
} |
50 |
|
|
51 |
|
/** |
52 |
< |
* Create set of first 5 ints |
52 |
> |
* Returns a new set of first 5 ints. |
53 |
|
*/ |
54 |
|
private ConcurrentSkipListSet set5() { |
55 |
|
ConcurrentSkipListSet q = new ConcurrentSkipListSet(); |
461 |
|
public void testToArray2() { |
462 |
|
ConcurrentSkipListSet<Integer> q = populatedSet(SIZE); |
463 |
|
Integer[] ints = new Integer[SIZE]; |
464 |
< |
Integer[] array = q.toArray(ints); |
465 |
< |
assertSame(ints, array); |
464 |
> |
assertSame(ints, q.toArray(ints)); |
465 |
|
for (int i = 0; i < ints.length; i++) |
466 |
|
assertSame(ints[i], q.pollFirst()); |
467 |
|
} |
531 |
|
NavigableSet x = populatedSet(SIZE); |
532 |
|
NavigableSet y = serialClone(x); |
533 |
|
|
534 |
< |
assertTrue(x != y); |
534 |
> |
assertNotSame(x, y); |
535 |
|
assertEquals(x.size(), y.size()); |
536 |
|
assertEquals(x, y); |
537 |
|
assertEquals(y, x); |
685 |
|
0, setSize - 1, true, bs); |
686 |
|
} |
687 |
|
|
688 |
+ |
/** |
689 |
+ |
* addAll is idempotent |
690 |
+ |
*/ |
691 |
+ |
public void testAddAll_idempotent() throws Exception { |
692 |
+ |
Set x = populatedSet(SIZE); |
693 |
+ |
Set y = new ConcurrentSkipListSet(x); |
694 |
+ |
y.addAll(x); |
695 |
+ |
assertEquals(x, y); |
696 |
+ |
assertEquals(y, x); |
697 |
+ |
} |
698 |
+ |
|
699 |
|
static NavigableSet<Integer> newSet(Class cl) throws Exception { |
700 |
|
NavigableSet<Integer> result = (NavigableSet<Integer>) cl.newInstance(); |
701 |
|
assertEquals(0, result.size()); |