24 |
|
|
25 |
|
public static void main(String[] args) throws Exception { |
26 |
|
Class klass = Class.forName(args[0]); |
27 |
< |
int n = (args.length <= 1)? DEFAULT_SIZE : Integer.parseInt(args[1]); |
28 |
< |
int t = (args.length <= 2)? DEFAULT_TRIALS : Integer.parseInt(args[2]); |
27 |
> |
int n = (args.length <= 1) ? DEFAULT_SIZE : Integer.parseInt(args[1]); |
28 |
> |
int t = (args.length <= 2) ? DEFAULT_TRIALS : Integer.parseInt(args[2]); |
29 |
|
|
30 |
|
System.out.print("Class: " + klass.getName()); |
31 |
|
System.out.print(" ~iters: " + (long)n * (long)n); |
38 |
|
for (int k = 0; k < colls.length; ++k) { |
39 |
|
Object x = klass.newInstance(); |
40 |
|
if (x instanceof Collection) |
41 |
< |
colls[k] = (Collection<Integer>)x; |
41 |
> |
colls[k] = (Collection<Integer>) x; |
42 |
|
else if (x instanceof Map) |
43 |
< |
colls[k] = (Collection<Integer>)Collections.newSetFromMap((Map)x); |
43 |
> |
colls[k] = (Collection<Integer>) |
44 |
> |
Collections.newSetFromMap((Map) x); |
45 |
|
else |
46 |
|
throw new Error("bad class"); |
47 |
|
} |
120 |
|
k >>>= 1; |
121 |
|
} |
122 |
|
// let GC settle down |
123 |
< |
try { Thread.sleep(500); } catch(Exception ex) { return; } |
123 |
> |
try { Thread.sleep(500); } |
124 |
> |
catch (Exception ex) { return; } |
125 |
|
} |
126 |
|
|
127 |
|
|