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 |
|
/** |
7 |
|
* @test |
22 |
|
} |
23 |
|
|
24 |
|
public static void main(String[] args) throws Exception { |
25 |
< |
Class mapClass = java.util.concurrent.ConcurrentHashMap.class; |
25 |
> |
Class<?> mapClass = java.util.concurrent.ConcurrentHashMap.class; |
26 |
|
int numTests = 50; |
27 |
|
int size = 75000; |
28 |
|
|
73 |
|
stest(newMap(mapClass), size); |
74 |
|
} |
75 |
|
|
76 |
< |
static Map<Integer,Integer> newMap(Class cl) { |
76 |
> |
static Map<Integer,Integer> newMap(Class<?> cl) { |
77 |
|
try { |
78 |
|
Map m = (Map<Integer,Integer>)cl.newInstance(); |
79 |
|
return m; |
607 |
|
|
608 |
|
static void shuffle(Integer[] keys) { |
609 |
|
int size = keys.length; |
610 |
< |
for (int i=size; i>1; i--) { |
610 |
> |
for (int i = size; i > 1; i--) { |
611 |
|
int r = rng.nextInt(i); |
612 |
|
Integer t = keys[i-1]; |
613 |
|
keys[i-1] = keys[r]; |