// to ensure DHash will be created
.withGrowFactor(1.999))
.withKeysDomainComplement((byte) 0, (byte) 1);
ByteIntMap map;
SeparateKVByteIntDHash asDHash;
for (int i = 0; ; i++) {
map = factory.newMutableMap(i);
asDHash = (SeparateKVByteIntDHash) map;
if (asDHash.capacity() > 128) {
break;
}
}
int capacity = asDHash.capacity();
assertEquals(capacity - 1, ((MutableDHash) map).maxSize());
assertTrue(asDHash.freeValue() == 0 && asDHash.removedValue() == 1 ||
asDHash.freeValue() == 1 && asDHash.removedValue() == 0);
for (int i = 2; i < capacity; i++) {
map.put((byte) i, 0);
}
assertTrue(asDHash.freeValue() == 0 && asDHash.removedValue() == 1 ||
asDHash.freeValue() == 1 && asDHash.removedValue() == 0);
assertEquals(capacity, asDHash.capacity());
map.put((byte) 0, 0);
assertEquals(capacity, asDHash.capacity());
assertEquals(capacity - 1, sizeByValueIterator(map));
assertTrue(asDHash.freeValue() != 0 && asDHash.removedValue() == 1 ||
asDHash.freeValue() == 1 && asDHash.removedValue() != 0);
assertTrue(map.containsKey((byte) 0));
assertFalse(map.containsKey((byte) 1));
}