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 |
12 |
|
* can create one from a real dictionary (1 line per word) and then run |
13 |
|
* linux "shuf" to randomize entries. |
14 |
|
*/ |
15 |
– |
import java.util.*; |
15 |
|
import java.io.*; |
16 |
+ |
import java.util.*; |
17 |
|
|
18 |
|
public class MapCheck { |
19 |
|
static final Object MISSING = new Object(); |
20 |
|
static TestTimer timer = new TestTimer(); |
21 |
< |
static Class eclass; |
22 |
< |
static Class mapClass = java.util.concurrent.ConcurrentHashMap.class; |
21 |
> |
static Class<?> eclass; |
22 |
> |
static Class<?> mapClass = java.util.concurrent.ConcurrentHashMap.class; |
23 |
|
|
24 |
|
static final LoopHelpers.SimpleRandom srng = new LoopHelpers.SimpleRandom(); |
25 |
|
static final Random rng = new Random(3152688); |
79 |
|
Object[] absent = new Object[size]; |
80 |
|
initializeKeys(key, absent, size); |
81 |
|
|
82 |
< |
precheck(size, key, absent); |
82 |
> |
precheck(size, key, absent); |
83 |
|
|
84 |
|
for (int rep = 0; rep < numTests; ++rep) { |
85 |
|
mainTest(newMap(), key, absent); |
705 |
|
|
706 |
|
static void shuffle(Object[] keys) { |
707 |
|
int size = keys.length; |
708 |
< |
for (int i= size; i>1; i--) { |
708 |
> |
for (int i = size; i > 1; i--) { |
709 |
|
int r = rng.nextInt(i); |
710 |
|
Object t = keys[i-1]; |
711 |
|
keys[i-1] = keys[r]; |
715 |
|
|
716 |
|
static void shuffle(ArrayList keys) { |
717 |
|
int size = keys.size(); |
718 |
< |
for (int i= size; i>1; i--) { |
718 |
> |
for (int i = size; i > 1; i--) { |
719 |
|
int r = rng.nextInt(i); |
720 |
|
Object t = keys.get(i-1); |
721 |
|
keys.set(i-1, keys.get(r)); |