public void testDuell() {
final Long[] values = new Long[randomIntBetween(1, 100000)];
for (int i = 0; i < values.length; ++i) {
values[i] = randomLong();
}
final LongLongMap valueToId = new LongLongOpenHashMap();
final long[] idToValue = new long[values.length];
final int iters = randomInt(1000000);
for (int i = 0; i < iters; ++i) {
final Long value = randomFrom(values);
if (valueToId.containsKey(value)) {
assertEquals(-1 - valueToId.get(value), hash.add(value));
} else {
assertEquals(valueToId.size(), hash.add(value));
idToValue[valueToId.size()] = value;
valueToId.put(value, valueToId.size());
}
}
assertEquals(valueToId.size(), hash.size());
for (Iterator<LongLongCursor> iterator = valueToId.iterator(); iterator.hasNext(); ) {
final LongLongCursor next = iterator.next();
assertEquals(next.value, hash.find(next.key));
}
for (long i = 0; i < hash.capacity(); ++i) {