1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
import java.util.*; |
7 |
|
import java.io.*; |
23 |
|
static final int numTests = 2; |
24 |
|
|
25 |
|
public static void main(String[] args) { |
26 |
< |
Class collectionClass = null; |
26 |
> |
Class<?> collectionClass = null; |
27 |
|
try { |
28 |
|
collectionClass = Class.forName(args[0]); |
29 |
|
} catch (ClassNotFoundException e) { |
40 |
|
|
41 |
|
} |
42 |
|
|
43 |
< |
static void tests(Class collectionClass, int numTests, int sizeIndex) { |
43 |
> |
static void tests(Class<?> collectionClass, int numTests, int sizeIndex) { |
44 |
|
try { |
45 |
|
String[] key = readWords(sizeIndex); |
46 |
|
int size = key.length; |
64 |
|
} |
65 |
|
|
66 |
|
|
67 |
< |
static Collection<String> newCollection(Class cl) { |
67 |
> |
static Collection<String> newCollection(Class<?> cl) { |
68 |
|
try { |
69 |
< |
Collection m = (Collection<String>)cl.newInstance(); |
69 |
> |
Collection m = (Collection<String>) cl.newInstance(); |
70 |
|
return m; |
71 |
|
} catch (Exception e) { |
72 |
|
throw new RuntimeException("Can't instantiate " + cl + ": " + e); |
114 |
|
long startTime = System.currentTimeMillis(); |
115 |
|
runner.run(); |
116 |
|
long afterRun = System.currentTimeMillis(); |
117 |
< |
long runTime = (afterRun - startTime); |
117 |
> |
long runTime = afterRun - startTime; |
118 |
|
int np = runner.total; |
119 |
|
if (runner.total == runner.hashCode()) |
120 |
|
System.out.println("Useless Number" + runner.total); |
173 |
|
if (r < pctrem) { |
174 |
|
collection.remove(k); |
175 |
|
++nremoves; |
176 |
< |
j += ((r >>> 8) & 7) + n / 2; |
176 |
> |
j += ((r >>> 8) & 7) + n / 2; |
177 |
|
if (j >= n) j -= n; |
178 |
|
} |
179 |
|
} |