26 |
|
* @bug 4339792 |
27 |
|
* @summary Basic test for Collections.disjoint |
28 |
|
* @author Josh Bloch |
29 |
< |
* |
30 |
< |
* @compile -source 1.5 Disjoint.java |
31 |
< |
* @run main Disjoint |
29 |
> |
* @key randomness |
30 |
|
*/ |
31 |
|
|
32 |
|
import java.util.*; |
33 |
|
|
34 |
|
public class Disjoint { |
35 |
< |
final static int N = 20; |
35 |
> |
static final int N = 20; |
36 |
|
|
37 |
< |
public static void main(String args[]) { |
37 |
> |
public static void main(String[] args) { |
38 |
|
// Make an array of lists each of which shares a single element |
39 |
|
// with its "neighbors," and no elements with other lists in the array |
40 |
|
Random rnd = new Random(); |
42 |
|
int x = 0; |
43 |
|
for (int i = 0; i < N; i++) { |
44 |
|
int size = rnd.nextInt(10) + 2; |
45 |
< |
List<Integer> list = new ArrayList<Integer>(size); |
45 |
> |
List<Integer> list = new ArrayList<>(size); |
46 |
|
for (int j = 1; j < size; j++) |
47 |
|
list.add(x++); |
48 |
|
list.add(x); |