4 |
|
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
< |
import java.util.*; |
8 |
< |
import java.util.concurrent.*; |
7 |
> |
import java.util.Collection; |
8 |
> |
import java.util.Random; |
9 |
> |
import java.util.concurrent.CyclicBarrier; |
10 |
> |
import java.util.concurrent.ExecutorService; |
11 |
> |
import java.util.concurrent.Executors; |
12 |
|
|
13 |
|
public class CollectionLoops { |
14 |
|
static int pinsert = 100; |
108 |
|
static void test(int i, int nk, int nops, Class<?> collectionClass) throws Exception { |
109 |
|
if (print) |
110 |
|
System.out.print("Threads: " + i + "\t:"); |
111 |
< |
Collection<Integer> collection = (Collection<Integer>)collectionClass.newInstance(); |
111 |
> |
Collection<Integer> collection = |
112 |
> |
(Collection<Integer>) collectionClass.getConstructor().newInstance(); |
113 |
|
Integer[] key = makeKeys(nk); |
114 |
|
// Uncomment to start with a non-empty table |
115 |
|
for (int j = 0; j < nk; j += 2) |