10 |
|
import java.util.Iterator; |
11 |
|
import java.util.NavigableSet; |
12 |
|
import java.util.SortedSet; |
13 |
+ |
import java.util.Set; |
14 |
|
import java.util.TreeSet; |
15 |
|
|
16 |
|
public class TreeSubSetTest extends JSR166TestCase { |
28 |
|
} |
29 |
|
|
30 |
|
/** |
31 |
< |
* Create a set of given size containing consecutive |
31 |
> |
* Returns a new set of given size containing consecutive |
32 |
|
* Integers 0 ... n. |
33 |
|
*/ |
34 |
|
private NavigableSet<Integer> populatedSet(int n) { |
48 |
|
} |
49 |
|
|
50 |
|
/** |
51 |
< |
* Create set of first 5 ints |
51 |
> |
* Returns a new set of first 5 ints. |
52 |
|
*/ |
53 |
|
private NavigableSet set5() { |
54 |
|
TreeSet q = new TreeSet(); |
1106 |
|
assertEquals(4, set.size()); |
1107 |
|
} |
1108 |
|
|
1109 |
+ |
/** |
1110 |
+ |
* addAll is idempotent |
1111 |
+ |
*/ |
1112 |
+ |
public void testAddAll_idempotent() throws Exception { |
1113 |
+ |
Set x = populatedSet(SIZE); |
1114 |
+ |
Set y = new TreeSet(x); |
1115 |
+ |
y.addAll(x); |
1116 |
+ |
assertEquals(x, y); |
1117 |
+ |
assertEquals(y, x); |
1118 |
+ |
} |
1119 |
+ |
|
1120 |
|
} |