34 |
|
} |
35 |
|
final int threadCount = 2; |
36 |
|
List<RandomCollector> collectors = new ArrayList<>(); |
37 |
< |
List<Thread> threads = new ArrayList<Thread>(); |
37 |
> |
List<Thread> threads = new ArrayList<>(); |
38 |
|
for (int i = 0; i < threadCount; i++) { |
39 |
|
RandomCollector r = new RandomCollector(); |
40 |
|
collectors.add(r); |
45 |
|
for (Thread thread : threads) |
46 |
|
thread.join(); |
47 |
|
int collisions = 0; |
48 |
< |
HashSet<Long> s = new HashSet<Long>(); |
48 |
> |
HashSet<Long> s = new HashSet<>(); |
49 |
|
for (RandomCollector r : collectors) { |
50 |
|
for (long x : r.randoms) { |
51 |
|
if (s.contains(x)) |