34 |
|
public class Disjoint { |
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); |