public void testUpdate() {
int size = 100000;
Random r = new Random();
int[] ints = new int[size];
Int2IntMap map = new Int2IntOpenHashMapWritable();
for (int i = 0; i < size; i++) {
int k = r.nextInt(size);
map.put(i, k);
ints[i] = k;
}
assertEquals(size, map.size());
for (int i = 0; i < size; i++) {
map.put(i, ints[i] + 1);
}
assertEquals(size, map.size());
for (int i = 0; i < size; i++) {
assertEquals(ints[i] + 1, map.get(i));
assertTrue(map.containsKey(i));
}
}