int[] x = new int[len];
for (int i = 0; i < len; i++) {
int key = random ? rand.nextInt() : i;
x[i] = key;
}
IntIntHashMap map = new IntIntHashMap();
for (int i = 0; i < len; i++) {
map.put(x[i], i);
}
for (int i = 0; i < len; i++) {
if (map.get(x[i]) != i) {
throw new AssertionError("get " + x[i] + " = " + map.get(i) + " should be " + i);
}
}
for (int i = 1; i < len; i += 2) {
map.remove(x[i]);
}
for (int i = 1; i < len; i += 2) {
if (map.get(x[i]) != -1) {
throw new AssertionError("get " + x[i] + " = " + map.get(i) + " should be <=0");
}
}
for (int i = 1; i < len; i += 2) {
map.put(x[i], i);
}
for (int i = 0; i < len; i++) {
if (map.get(x[i]) != i) {
throw new AssertionError("get " + x[i] + " = " + map.get(i) + " should be " + i);
}
}
}