29 |
|
if (args.length > 0) { |
30 |
|
try { |
31 |
|
mapClass = Class.forName(args[0]); |
32 |
< |
} catch(ClassNotFoundException e) { |
32 |
> |
} catch (ClassNotFoundException e) { |
33 |
|
throw new RuntimeException("Class " + args[0] + " not found."); |
34 |
|
} |
35 |
|
} |
77 |
|
try { |
78 |
|
Map m = (Map<Integer,Integer>)cl.newInstance(); |
79 |
|
return m; |
80 |
< |
} catch(Exception e) { |
80 |
> |
} catch (Exception e) { |
81 |
|
throw new RuntimeException("Can't instantiate " + cl + ": " + e); |
82 |
|
} |
83 |
|
} |
108 |
|
timer.start(nm, n * iters); |
109 |
|
for (int j = 0; j < iters; ++j) { |
110 |
|
for (int i = 0; i < n; i++) { |
111 |
< |
if ((Integer)(s.get(i)) != i) ++sum; |
111 |
> |
if (s.get(i) != i) ++sum; |
112 |
|
} |
113 |
|
} |
114 |
|
timer.finish(); |
219 |
|
int sum = 0; |
220 |
|
timer.start("Iter Key ", size); |
221 |
|
for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { |
222 |
< |
if(it.next() != MISSING) |
222 |
> |
if (it.next() != MISSING) |
223 |
|
++sum; |
224 |
|
} |
225 |
|
timer.finish(); |
232 |
|
int sum = 0; |
233 |
|
timer.start("Iter Value ", size); |
234 |
|
for (Iterator it = s.values().iterator(); it.hasNext(); ) { |
235 |
< |
if(it.next() != MISSING) |
235 |
> |
if (it.next() != MISSING) |
236 |
|
++sum; |
237 |
|
} |
238 |
|
timer.finish(); |
244 |
|
int sum = 0; |
245 |
|
timer.start("Iter Entry ", size); |
246 |
|
for (Iterator it = s.entrySet().iterator(); it.hasNext(); ) { |
247 |
< |
if(it.next() != MISSING) |
247 |
> |
if (it.next() != MISSING) |
248 |
|
++sum; |
249 |
|
} |
250 |
|
timer.finish(); |
272 |
|
reallyAssert (!s.containsKey(k)); |
273 |
|
while (it.hasNext()) { |
274 |
|
Map.Entry<Integer,Integer> x = (Map.Entry<Integer,Integer>)(it.next()); |
275 |
< |
Integer k2 = (Integer)x.getKey(); |
275 |
> |
Integer k2 = x.getKey(); |
276 |
|
seen.put(k2, k2); |
277 |
|
if (k2 != MISSING) |
278 |
|
++sum; |
348 |
|
|
349 |
|
static void entest(Map<Integer,Integer> s, int size) { |
350 |
|
if (s instanceof Hashtable) { |
351 |
< |
Hashtable ht = (Hashtable)s; |
351 |
> |
Hashtable ht = (Hashtable) s; |
352 |
|
// entest3(ht, size); |
353 |
|
// entest4(ht, size); |
354 |
|
entest1(ht, size); |
532 |
|
static void printStats() { |
533 |
|
for (Iterator it = accum.entrySet().iterator(); it.hasNext(); ) { |
534 |
|
Map.Entry e = (Map.Entry)(it.next()); |
535 |
< |
Stats stats = ((Stats)(e.getValue())); |
535 |
> |
Stats stats = ((Stats) (e.getValue())); |
536 |
|
long n = stats.number; |
537 |
|
double t; |
538 |
|
if (n > 0) |
568 |
|
void finish() { |
569 |
|
long endTime = System.nanoTime(); |
570 |
|
long time = endTime - startTime; |
571 |
< |
double timePerOp = ((double)time)/numOps; |
571 |
> |
double timePerOp = ((double) time)/numOps; |
572 |
|
|
573 |
|
Object st = accum.get(name); |
574 |
|
if (st == null) |